Fix column width bug

This commit is contained in:
2022-09-11 01:51:40 +00:00
parent 690f90949b
commit 3354cd303b

View File

@@ -69,16 +69,17 @@
(+= nextControlY control.height)
// TODO controls that aren't the same height as text will be able to vertically overflow
(let [columnControls (controls.members.slice (if title 1 0))]
(when (and columnControls (= 0 (% columnControls.length controlsPerColumn)))
(set nextControlY 0)
(when title (+= nextControlY control.height))
(let [lastColumnWidth (+ textSize (apply max
(for control (last (groups columnControls controlsPerColumn))
control.width)))]
(columnWidths.push lastColumnWidth)
(when (> (apply + columnWidths) width)
(makeScrollArrows))
(+= nextControlX lastColumnWidth)))))
(if (and columnControls (= 0 (% columnControls.length controlsPerColumn)))
{
(set nextControlY 0)
(when title (+= nextControlY control.height))
(+= nextControlX (last columnWidths))
(columnWidths.push (+ control.width textSize))
(when (> (apply + columnWidths) width)
(makeScrollArrows))
}
(setNth columnWidths -1 (max (+ control.width textSize) (last columnWidths)))))
control)
(prop &mut :FlxText leftText)
(prop &mut :FlxText rightText)
@@ -123,12 +124,12 @@
(prop &mut _shown false)
(method isShown [] _shown)
(prop &mut :Array<Float> columnWidths [])
(prop &mut :kiss.List<Float> columnWidths [0.0])
(prop &mut cameraColumn 0)
(prop &mut hasScrollArrows false)
(method clearControls []
(set columnWidths [])
(set columnWidths [0.0])
(set hasScrollArrows false)
(_actions.clear)
(controls.clear)