Skip to content

Commit f1d9ae6

Browse files
committed
Update code docs
1 parent 494668c commit f1d9ae6

3 files changed

Lines changed: 19 additions & 43 deletions

File tree

docs/components_IconButton.bs.html

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
' Set default colors
2727
m.top.background = colorConstants.background_primary
28-
m.top.iconBackground = colorConstants.text_secondary
28+
m.top.iconBackground = colorConstants.text_primary
2929
m.top.focusBackground = colorConstants.background_secondary
3030
m.top.iconFocusBackground = colorConstants.text_primary
3131
end sub
@@ -89,53 +89,26 @@
8989
end sub
9090

9191
sub setIconSize()
92-
height = m.top.height
93-
width = m.top.width
94-
if height > 0 and width > 0
95-
' TODO: Use smallest number between them
96-
m.buttonIcon.height = m.top.height
92+
' determine size of icon
93+
if m.buttonIcon.bitmapWidth > 0 and m.buttonIcon.bitmapHeight > 0
94+
iconWidth = m.buttonIcon.bitmapWidth
95+
iconHeight = m.buttonIcon.bitmapHeight
9796

97+
' set buttonBackground width and height to size of poster + padding
9898
if m.top.padding > 0
99-
m.buttonIcon.height = m.buttonIcon.height - m.top.padding
99+
m.buttonBackground.width = iconWidth + (m.top.padding * 2)
100+
m.buttonBackground.height = iconHeight + (m.top.padding * 2)
101+
else
102+
m.buttonBackground.width = iconWidth
103+
m.buttonBackground.height = iconHeight
100104
end if
101105

102-
m.buttonIcon.width = m.buttonIcon.height
103-
104-
m.buttonIcon.translation = [((width - m.buttonIcon.width) / 2), ((height - m.buttonIcon.height) / 2)]
105-
m.buttonText.translation = [0, height + 10]
106-
m.buttonText.width = width
107-
else if height = 0 and width = 0
108-
' determine size of icon
109-
if m.buttonIcon.bitmapWidth > 0 and m.buttonIcon.bitmapHeight > 0
110-
iconWidth = m.buttonIcon.bitmapWidth
111-
iconHeight = m.buttonIcon.bitmapHeight
112-
113-
' set buttonBackground width and height to size of poster + padding
114-
if m.top.padding > 0
115-
m.buttonBackground.width = iconWidth + (m.top.padding * 2)
116-
m.buttonBackground.height = iconHeight + (m.top.padding * 2)
117-
else
118-
m.buttonBackground.width = iconWidth
119-
m.buttonBackground.height = iconHeight
120-
end if
121-
122-
m.buttonIcon.translation = [((m.buttonBackground.width - iconWidth) / 2), ((m.buttonBackground.height - iconHeight) / 2)]
123-
m.buttonText.translation = [0, m.buttonBackground.height + 10]
124-
m.buttonText.width = width
125-
end if
106+
m.buttonIcon.translation = [((m.buttonBackground.width - iconWidth) / 2), ((m.buttonBackground.height - iconHeight) / 2)]
107+
m.buttonText.translation = [0, m.buttonBackground.height + 12]
108+
m.buttonText.width = m.buttonBackground.width
126109
end if
127110
end sub
128111

129-
sub onHeightChanged()
130-
m.buttonBackground.height = m.top.height
131-
setIconSize()
132-
end sub
133-
134-
sub onWidthChanged()
135-
m.buttonBackground.width = m.top.width
136-
setIconSize()
137-
end sub
138-
139112
sub onPaddingChanged()
140113
setIconSize()
141114
end sub
@@ -162,6 +135,9 @@
162135
' translate the button so the focus border is visible
163136
m.buttonBackground.translation = [m.top.borderSize, m.top.borderSize]
164137
m.buttonIcon.translation = [m.top.padding + m.top.borderSize, m.top.padding + m.top.borderSize]
138+
139+
m.buttonText.translation = [0, m.buttonBackground.height + 12 + m.top.borderSize]
140+
m.buttonText.width = m.buttonFocusBorder.width
165141
end sub
166142

167143
function onKeyEvent(key as string, press as boolean) as boolean

docs/data/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/module-IconButton.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)