Remove toggle switch left padding when text is empty
This commit is contained in:
parent
ab0c6a5012
commit
bda80a6d06
@ -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) Fix `Tooltip` text not showing for circular buttons.
|
||||||
- (CSS) Prevent context menu from inheriting text input font properties.
|
- (CSS) Prevent context menu from inheriting text input font properties.
|
||||||
- (CSS) Fix invalid `DatePicker` cell size.
|
- (CSS) Fix invalid `DatePicker` cell size.
|
||||||
|
- (Base) Remove `ToggleSwitch` left padding when text is empty.
|
||||||
- (Base) Fix `PasswordTextFormatter` garbled input.
|
- (Base) Fix `PasswordTextFormatter` garbled input.
|
||||||
|
|
||||||
## [1.1.0] - 2022-10-10
|
## [1.1.0] - 2022-10-10
|
||||||
|
@ -144,12 +144,14 @@ public class ToggleSwitchSkin extends SkinBase<ToggleSwitch> {
|
|||||||
double thumbAreaWidth = snapSizeX(thumbArea.prefWidth(-1));
|
double thumbAreaWidth = snapSizeX(thumbArea.prefWidth(-1));
|
||||||
double thumbAreaHeight = snapSizeX(thumbArea.prefHeight(-1));
|
double thumbAreaHeight = snapSizeX(thumbArea.prefHeight(-1));
|
||||||
double thumbAreaY = snapPositionX(contentY + (contentHeight / 2) - (thumbAreaHeight / 2));
|
double thumbAreaY = snapPositionX(contentY + (contentHeight / 2) - (thumbAreaHeight / 2));
|
||||||
|
double labelContainerWidth = label.getText() != null && !label.getText().isEmpty()
|
||||||
|
? contentWidth - thumbAreaWidth : 0;
|
||||||
|
|
||||||
thumbArea.resize(thumbAreaWidth, thumbAreaHeight);
|
thumbArea.resize(thumbAreaWidth, thumbAreaHeight);
|
||||||
thumbArea.setLayoutX(contentWidth - thumbAreaWidth);
|
thumbArea.setLayoutX(labelContainerWidth);
|
||||||
thumbArea.setLayoutY(thumbAreaY);
|
thumbArea.setLayoutY(thumbAreaY);
|
||||||
|
|
||||||
labelContainer.resize(contentWidth - thumbAreaWidth, thumbAreaHeight);
|
labelContainer.resize(labelContainerWidth, thumbAreaHeight);
|
||||||
labelContainer.setLayoutY(thumbAreaY);
|
labelContainer.setLayoutY(thumbAreaY);
|
||||||
|
|
||||||
// layout the thumb on the "unselected" position
|
// layout the thumb on the "unselected" position
|
||||||
|
Loading…
Reference in New Issue
Block a user