Buttons, mostly
This commit is contained in:
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
|
||||
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
|
||||
|
||||
|
||||
@@ -33,18 +33,16 @@
|
||||
<children>
|
||||
<Font id="normalFont" uri="font:SystemFontFile" size="24" />
|
||||
<Font id="boldFont" uri="font:BoldSystemFontFile" size="24" />
|
||||
<Group id="animationRoot">
|
||||
<Group id="anchor">
|
||||
<Poster
|
||||
id="background"
|
||||
uri="pkg:/images/button-ex.9.png">
|
||||
<Poster id="icon" />
|
||||
<Label
|
||||
id="label"
|
||||
horizAlign="center"
|
||||
vertAlign="center" />
|
||||
</Poster>
|
||||
</Group>
|
||||
<Group id="anchor">
|
||||
<Poster
|
||||
id="background"
|
||||
uri="pkg:/images/button-ex.9.png">
|
||||
<Poster id="icon" />
|
||||
<Label
|
||||
id="label"
|
||||
horizAlign="center"
|
||||
vertAlign="center" />
|
||||
</Poster>
|
||||
</Group>
|
||||
<Animation
|
||||
id="focusAnimation"
|
||||
@@ -54,7 +52,7 @@
|
||||
id="scale"
|
||||
key="[ 0.0, 0.5, 1.0 ]"
|
||||
keyValue="[ [ 1.0, 1.0 ], [ 1.05, 1.05 ], [ 1.0, 1.0 ] ]"
|
||||
fieldToInterp="animationRoot.scale" />
|
||||
fieldToInterp="anchor.scale" />
|
||||
</Animation>
|
||||
</children>
|
||||
</component>
|
||||
Reference in new issue
Block a user