Skip to content

Commit

Permalink
Remove toggle switch left padding when text is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
mkpaz committed Feb 11, 2023
1 parent ab0c6a5 commit bda80a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This is a bugfix/maintenance release that also contains a few style improvements
- (CSS) Fix `Tooltip` text not showing for circular buttons.
- (CSS) Prevent context menu from inheriting text input font properties.
- (CSS) Fix invalid `DatePicker` cell size.
- (Base) Remove `ToggleSwitch` left padding when text is empty.
- (Base) Fix `PasswordTextFormatter` garbled input.

## [1.1.0] - 2022-10-10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ protected void layoutChildren(double contentX, double contentY, double contentWi
double thumbAreaWidth = snapSizeX(thumbArea.prefWidth(-1));
double thumbAreaHeight = snapSizeX(thumbArea.prefHeight(-1));
double thumbAreaY = snapPositionX(contentY + (contentHeight / 2) - (thumbAreaHeight / 2));
double labelContainerWidth = label.getText() != null && !label.getText().isEmpty()
? contentWidth - thumbAreaWidth : 0;

thumbArea.resize(thumbAreaWidth, thumbAreaHeight);
thumbArea.setLayoutX(contentWidth - thumbAreaWidth);
thumbArea.setLayoutX(labelContainerWidth);
thumbArea.setLayoutY(thumbAreaY);

labelContainer.resize(contentWidth - thumbAreaWidth, thumbAreaHeight);
labelContainer.resize(labelContainerWidth, thumbAreaHeight);
labelContainer.setLayoutY(thumbAreaY);

// layout the thumb on the "unselected" position
Expand Down

0 comments on commit bda80a6

Please sign in to comment.