Shift-enter to add alternates

This commit is contained in:
2022-08-30 19:05:58 +00:00
parent 04643ad243
commit 129335ac59
2 changed files with 11 additions and 7 deletions

View File

@@ -123,8 +123,8 @@
(set typeAdding type) (set typeAdding type)
(set labelsAdding []) (set labelsAdding [])
(set addingLabels true) (set addingLabels true)
(localVar &mut title "Alternating labels for this habit:") (localVar &mut title "Add a label for this habit, or use SHIFT+ENTER to add a series of alternating labels:")
(whenLet [Todo type] (set title "Steps for completing this task:")) (whenLet [Todo type] (set title "Add a label for this task, or use SHIFT+ENTER to add a series of steps for completing this task:"))
(set entryCreationWindow (new SimpleWindow title null null 0.9 0.9)) (set entryCreationWindow (new SimpleWindow title null null 0.9 0.9))
(set entryNameText (new FlxInputText 0 0 FlxG.width "" textSize true)) (set entryNameText (new FlxInputText 0 0 FlxG.width "" textSize true))
(entryCreationWindow.addControl entryNameText) (entryCreationWindow.addControl entryNameText)
@@ -136,11 +136,14 @@
(when (and entryNameText FlxG.keys.justPressed.ENTER) (when (and entryNameText FlxG.keys.justPressed.ENTER)
(cond (cond
((and FlxG.keys.pressed.SHIFT addingLabels)
(when (entryNameText.text.trim)
(entryCreationWindow.makeText entryNameText.text)
(labelsAdding.push entryNameText.text)
(set entryNameText.text "")
(set entryNameText.caretIndex 0)))
(addingLabels (addingLabels
(entryCreationWindow.makeText entryNameText.text) (addCreatedEntry))
(labelsAdding.push entryNameText.text)
(set entryNameText.text "")
(set entryNameText.caretIndex 0))
(true (true
(startAddingInterval)))) (startAddingInterval))))
} }
@@ -825,7 +828,7 @@
(method addCreatedEntry [] (method addCreatedEntry []
// addEntry() calls save() // addEntry() calls save()
(when entryNameText.text (when (entryNameText.text.trim)
(labelsAdding.push entryNameText.text)) (labelsAdding.push entryNameText.text))
(unless labelsAdding (unless labelsAdding
(return)) (return))

View File

@@ -54,6 +54,7 @@
// TODO could make a camera on the window so the controls are clipped by the camera // TODO could make a camera on the window so the controls are clipped by the camera
(method addControl [:FlxSprite control] (method addControl [:FlxSprite control]
(set control.cameras this.cameras)
(set control.x nextControlX) (set control.x nextControlX)
(set control.y nextControlY) (set control.y nextControlY)
(controls.add control) (controls.add control)