Buttons, mostly

This commit is contained in:
Brahim Hadriche committed 2024-03-13 13:34:59 -04:00
1 parent 750e24f724
commit 888f7da214
6 files changed
+61 -55

No files matched your search

@@ -31,7 +31,6 @@ function DoLayout() as void
iconWidth = 0 iconWidth = 0
iconHeight = 0 iconHeight = 0
textWidth = 0 textWidth = 0
textHeight = 0
iconTextSpacing = 0 iconTextSpacing = 0
if iconVisible if iconVisible
@@ -43,7 +42,6 @@ function DoLayout() as void
if textVisible if textVisible
labelRect = m.labelNode.boundingRect() labelRect = m.labelNode.boundingRect()
textWidth = labelRect.width textWidth = labelRect.width
textHeight = labelRect.height
contentWidth += textWidth contentWidth += textWidth
end if end if
@@ -65,8 +63,8 @@ function DoLayout() as void
if textVisible if textVisible
x = (width - contentWidth) / 2 + padding[0] + iconWidth + iconTextSpacing x = (width - contentWidth) / 2 + padding[0] + iconWidth + iconTextSpacing
y = (height - textHeight) / 2 m.labelNode.height = height
m.labelNode.translation = [x, y] m.labelNode.translation = [x, 0]
end if end if
OnAnchorChange() OnAnchorChange()
@@ -77,6 +75,7 @@ function OnAnchorChange()
height = m.top.height height = m.top.height
anchor = m.top.anchor anchor = m.top.anchor
m.anchorNode.scaleRotateCenter = [width / 2, height / 2]
m.anchorNode.translation = [-width * anchor[0], -height * anchor[1]] m.anchorNode.translation = [-width * anchor[0], -height * anchor[1]]
end function end function
@@ -33,18 +33,16 @@
<children> <children>
<Font id="normalFont" uri="font:SystemFontFile" size="24" /> <Font id="normalFont" uri="font:SystemFontFile" size="24" />
<Font id="boldFont" uri="font:BoldSystemFontFile" size="24" /> <Font id="boldFont" uri="font:BoldSystemFontFile" size="24" />
<Group id="animationRoot"> <Group id="anchor">
<Group id="anchor"> <Poster
<Poster id="background"
id="background" uri="pkg:/images/button-ex.9.png">
uri="pkg:/images/button-ex.9.png"> <Poster id="icon" />
<Poster id="icon" /> <Label
<Label id="label"
id="label" horizAlign="center"
horizAlign="center" vertAlign="center" />
vertAlign="center" /> </Poster>
</Poster>
</Group>
</Group> </Group>
<Animation <Animation
id="focusAnimation" id="focusAnimation"
@@ -54,7 +52,7 @@
id="scale" id="scale"
key="[ 0.0, 0.5, 1.0 ]" key="[ 0.0, 0.5, 1.0 ]"
keyValue="[ [ 1.0, 1.0 ], [ 1.05, 1.05 ], [ 1.0, 1.0 ] ]" keyValue="[ [ 1.0, 1.0 ], [ 1.05, 1.05 ], [ 1.0, 1.0 ] ]"
fieldToInterp="animationRoot.scale" /> fieldToInterp="anchor.scale" />
</Animation> </Animation>
</children> </children>
</component> </component>
@@ -24,30 +24,31 @@
<ContentNode role="content" /> <ContentNode role="content" />
</CheckList> </CheckList>
<Button <ButtonEx
id="moveUpButton" id="moveUpButton"
iconVisible="false"
text="Move up" text="Move up"
showFocusFootprint="true"
minWidth="220" minWidth="220"
translation="[640,183]" /> translation="[640,183]" />
<Button <ButtonEx
id="moveDownButton" id="moveDownButton"
iconVisible="false"
text="Move down" text="Move down"
showFocusFootprint="true"
minWidth="220" minWidth="220"
translation="[640,273]" /> translation="[640,273]" />
<Button
id="closeButton" <ButtonEx
text="Close"
showFocusFootprint="true"
minWidth="150"
translation="[500,500]" />
<Button
id="saveButton" id="saveButton"
iconVisible="false"
text="Save" text="Save"
showFocusFootprint="true" padding="[30,30]"
minWidth="150" translation="[340,500]" />
translation="[320,500]" /> <ButtonEx
id="closeButton"
iconVisible="false"
text="Close"
padding="[30,30]"
translation="[496,500]" />
</Rectangle> </Rectangle>
</children> </children>
</component> </component>
@@ -23,17 +23,18 @@
id="textEditBox" id="textEditBox"
width="480" width="480"
height="50" height="50"
translation="[200,50]" /> iconWidth="32"
<Button iconHeight="32"
padding="[10,10]"
translation="[170,50]" />
<ButtonEx
id="editButton" id="editButton"
text=""
minWidth="64"
maxWidth="80"
height="48"
iconUri="pkg:/images/icons/edit-48-white.png" iconUri="pkg:/images/icons/edit-48-white.png"
focusedIconUri="pkg:/images/icons/edit-48-black.png" height="50"
showFocusFootprint="true" iconWidth="22"
translation="[692,50]" /> iconHeight="22"
text="Edit"
translation="[670,50]" />
<Label <Label
text="OR" text="OR"
translation="[460,110]"> translation="[460,110]">
@@ -59,17 +60,18 @@
</InvidiousPublicInstances> </InvidiousPublicInstances>
<Button <ButtonEx
id="testButton" id="testButton"
text="Test instance" text="Test instance"
showFocusFootprint="true" iconVisible="false"
translation="[495,507]" /> padding="[30,30]"
<Button translation="[300,510]" />
<ButtonEx
id="saveButton" id="saveButton"
text="Save" text="Save"
showFocusFootprint="true" iconVisible="false"
minWidth="150" padding="[30,30]"
translation="[768,507]" /> translation="[545,510]" />
</Rectangle> </Rectangle>
</children> </children>
</component> </component>
@@ -32,12 +32,13 @@
vertFocusAnimationStyle="floatingFocus" vertFocusAnimationStyle="floatingFocus"
translation="[50,80]" translation="[50,80]"
itemComponentName="InvidiousInstanceTestingItem" /> itemComponentName="InvidiousInstanceTestingItem" />
<Button <ButtonEx
id="closeButton" id="closeButton"
text="Close" text="Close"
minWidth="160" iconVisible="false"
showFocusFootprint="true" anchor="[0.5,0.5]"
translation="[400,506]" /> padding="[30,30]"
translation="[480,530]" />
</Rectangle> </Rectangle>
</children> </children>
</component> </component>
@@ -10,12 +10,17 @@
<Label <Label
id="failedLabel" id="failedLabel"
text="Failed to load Invidious public instances." text="Failed to load Invidious public instances."
translation="[190,60]" /> horizAlign="center"
<Button translation="[180,60]"
width="500" />
<ButtonEx
id="refreshButton" id="refreshButton"
minWidth="180" iconVisible="false"
text="Refresh" text="Refresh"
translation="[340,130]" /> anchor="[0.5,0]"
padding="[30,30]"
translation="[430,130]" />
<InvidiousPublicInstancesListItem id="instancesHeader"> <InvidiousPublicInstancesListItem id="instancesHeader">
<InvidiousPublicInstancesListItemContent <InvidiousPublicInstancesListItemContent