Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Oct 8, 2024
2 parents 4411383 + 2252c16 commit 959f4bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
3 changes: 2 additions & 1 deletion haxe/ui/_module/styles/default/tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
.tabbar-button {
border-radius: 0px;
background: $solid-background-color-down $solid-background-color-down vertical;
padding: 7px 14px;
padding: 7px 8px;
vertical-align: bottom;
border-left-width: 0px;
cursor: pointer;
icon-position: far-left;
}

.tabbar-button .icon {
Expand Down
18 changes: 5 additions & 13 deletions haxe/ui/components/Button.hx
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ class ButtonLayout extends DefaultLayout {
icon = null;
}

if (label != null && label.componentWidth != 0){
if (label != null && label.componentWidth != 0 && label.componentHeight != 0) {
label.top = calcLabelPositionTop();
label.left = calcLabelPositionLeft();
}
if (icon != null) {
if (icon != null && icon.componentWidth != 0 && icon.componentHeight != 0) {
if (label != null) {
icon.left = calcIconPositionLeft(label.left);
} else {
Expand All @@ -243,9 +243,6 @@ class ButtonLayout extends DefaultLayout {
var label:Label = component.findComponent(Label, false);
var icon:Image = component.findComponent("button-icon", false);


if (label == null || label.componentHeight == 0) return 0;

if (label != null && icon == null){
return Std.int((component.componentHeight / 2) - (label.componentHeight / 2)) + marginTop(label) - marginBottom(label);
}
Expand All @@ -270,8 +267,6 @@ class ButtonLayout extends DefaultLayout {
var icon:Image = component.findComponent("button-icon", false);
var label:Label = component.findComponent(Label, false);

if (icon == null || icon.componentWidth == 0) return 0;

if (label == null && icon != null) {
return Std.int((component.componentHeight / 2) - (icon.componentHeight / 2)) + marginTop(icon) - marginBottom(icon);
}
Expand All @@ -298,9 +293,6 @@ class ButtonLayout extends DefaultLayout {
var icon:Image = component.findComponent("button-icon", false);
var textAlign = cast(component, Button).textAlign;


if (label == null || label.componentWidth == 0) return 0;

if (label != null && icon == null){
return getTextAlignPos(label, component.componentWidth);
}
Expand All @@ -309,7 +301,9 @@ class ButtonLayout extends DefaultLayout {
if (iconPosition == "right" || iconPosition == "center-right" || iconPosition == "far-right") {
return paddingLeft + marginLeft(label) - marginRight(label);
} else if (iconPosition == "left" || iconPosition == "center-left" || iconPosition == "far-left") {
return paddingLeft + horizontalSpacing + icon.componentWidth + marginLeft(label) - marginRight(label);
var x = paddingLeft;
if (icon.componentWidth != 0) x += icon.componentWidth + horizontalSpacing;
return x + marginLeft(label) - marginRight(label);
}
}

Expand Down Expand Up @@ -344,8 +338,6 @@ class ButtonLayout extends DefaultLayout {
var label:Label = component.findComponent(Label, false);
var textAlign = cast(component, Button).textAlign;

if (icon == null || icon.componentWidth == 0) return 0;

if (label == null && icon != null) {
if (iconPosition == "far-right") {
return (component.componentWidth - icon.componentWidth - paddingRight) + marginLeft(icon) - marginRight(icon);
Expand Down

0 comments on commit 959f4bc

Please sign in to comment.