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 labelsAdding [])
(set addingLabels true)
(localVar &mut title "Alternating labels for this habit:")
(whenLet [Todo type] (set title "Steps for completing this task:"))
(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 "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 entryNameText (new FlxInputText 0 0 FlxG.width "" textSize true))
(entryCreationWindow.addControl entryNameText)
@@ -136,11 +136,14 @@
(when (and entryNameText FlxG.keys.justPressed.ENTER)
(cond
(addingLabels
((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))
(set entryNameText.caretIndex 0)))
(addingLabels
(addCreatedEntry))
(true
(startAddingInterval))))
}
@@ -825,7 +828,7 @@
(method addCreatedEntry []
// addEntry() calls save()
(when entryNameText.text
(when (entryNameText.text.trim)
(labelsAdding.push entryNameText.text))
(unless labelsAdding
(return))

View File

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