allow making text with overriden, out-of-layout position
This commit is contained in:
@@ -541,17 +541,22 @@
|
||||
(prop :Map<FlxSprite,String> _tooltips (new Map))
|
||||
(prop :Map<FlxSprite,FlxColor> _colors (new Map))
|
||||
(prop &mut :Bool selectFirstInteractiveControl true)
|
||||
(method &private makeText [:String text &opt :FlxColor color :Action onClick :Action onSelect :Action onDeselect :Bool noShortcut :FlxColor bgColor :Int margin :String tooltipText :Map<String,Action> altActions]
|
||||
(method &private makeText [:String text &opt :FlxColor color :Action onClick :Action onSelect :Action onDeselect :Bool noShortcut :FlxColor bgColor :Int margin :String tooltipText :Map<String,Action> altActions :FlxPoint overridePosition]
|
||||
(let [:FlxSprite ftext
|
||||
(if bgColor
|
||||
(let [p (SpriteTools.textPlate text textSize (or margin 0) color bgColor)]
|
||||
(set p.x nextControlX)
|
||||
(set p.y nextControlY)
|
||||
p)
|
||||
(new FlxText nextControlX nextControlY 0 text textSize))]
|
||||
(new FlxText
|
||||
(if overridePosition overridePosition.x nextControlX)
|
||||
(if overridePosition overridePosition.y nextControlY)
|
||||
0
|
||||
text
|
||||
textSize))]
|
||||
(set ftext.color (or color textColor))
|
||||
(dictSet _colors ftext ftext.color)
|
||||
(addControl ftext)
|
||||
(addControl ftext ?overridePosition)
|
||||
(when onSelect
|
||||
(dictSet _onSelectEvents ftext onSelect))
|
||||
(when onDeselect
|
||||
|
||||
Reference in New Issue
Block a user