From 888f7da21404f53d0294a97c373a3ec134d3da65 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Wed, 13 Mar 2024 13:34:59 -0400 Subject: [PATCH] Buttons, mostly --- .../src/components/ButtonEx/ButtonEx.bs | 7 ++-- .../src/components/ButtonEx/ButtonEx.xml | 24 ++++++------- .../HomeScreenEditor/HomeScreenEditor.xml | 29 ++++++++-------- .../InvidiousInstanceSettings.xml | 34 ++++++++++--------- .../InvidiousInstanceTesting.xml | 9 ++--- .../InvidiousPublicInstances.xml | 13 ++++--- 6 files changed, 61 insertions(+), 55 deletions(-) diff --git a/playlet-lib/src/components/ButtonEx/ButtonEx.bs b/playlet-lib/src/components/ButtonEx/ButtonEx.bs index 099084f6..9da30afd 100644 --- a/playlet-lib/src/components/ButtonEx/ButtonEx.bs +++ b/playlet-lib/src/components/ButtonEx/ButtonEx.bs @@ -31,7 +31,6 @@ function DoLayout() as void iconWidth = 0 iconHeight = 0 textWidth = 0 - textHeight = 0 iconTextSpacing = 0 if iconVisible @@ -43,7 +42,6 @@ function DoLayout() as void if textVisible labelRect = m.labelNode.boundingRect() textWidth = labelRect.width - textHeight = labelRect.height contentWidth += textWidth end if @@ -65,8 +63,8 @@ function DoLayout() as void if textVisible x = (width - contentWidth) / 2 + padding[0] + iconWidth + iconTextSpacing - y = (height - textHeight) / 2 - m.labelNode.translation = [x, y] + m.labelNode.height = height + m.labelNode.translation = [x, 0] end if OnAnchorChange() @@ -77,6 +75,7 @@ function OnAnchorChange() height = m.top.height anchor = m.top.anchor + m.anchorNode.scaleRotateCenter = [width / 2, height / 2] m.anchorNode.translation = [-width * anchor[0], -height * anchor[1]] end function diff --git a/playlet-lib/src/components/ButtonEx/ButtonEx.xml b/playlet-lib/src/components/ButtonEx/ButtonEx.xml index c56e5eb9..4ccb23d3 100644 --- a/playlet-lib/src/components/ButtonEx/ButtonEx.xml +++ b/playlet-lib/src/components/ButtonEx/ButtonEx.xml @@ -33,18 +33,16 @@ - - - - - - + + + + + fieldToInterp="anchor.scale" /> \ No newline at end of file diff --git a/playlet-lib/src/components/Screens/SettingsScreen/HomeScreenEditor/HomeScreenEditor.xml b/playlet-lib/src/components/Screens/SettingsScreen/HomeScreenEditor/HomeScreenEditor.xml index f50e4961..06238bf4 100644 --- a/playlet-lib/src/components/Screens/SettingsScreen/HomeScreenEditor/HomeScreenEditor.xml +++ b/playlet-lib/src/components/Screens/SettingsScreen/HomeScreenEditor/HomeScreenEditor.xml @@ -24,30 +24,31 @@ -