playground don't move camera when textinput has focus

This commit is contained in:
2021-09-18 18:42:36 -06:00
parent 9b228f8586
commit fe84da9ad4

View File

@@ -64,6 +64,8 @@
// Control the UI camera with the arrow keys, and the playground camera with wasd:
(var KEYBOARD_SCROLL_SPEED 200)
(method cameraKeyControl [:FlxCamera camera :Void->Bool leftKey :Void->Bool rightKey :Void->Bool upKey :Void->Bool downKey]
// but not when textInput is focused
(unless (and textInput textInput.hasFocus)
(let [scrollPerSec (/ KEYBOARD_SCROLL_SPEED 60)
&mut :FlxVector movement (new FlxPoint)]
(when (leftKey) (-= movement.x 1))
@@ -74,7 +76,7 @@
(set movement (movement.normalize)))
(movement.scale scrollPerSec)
(+= camera.scroll.x movement.x)
(+= camera.scroll.y movement.y)))
(+= camera.scroll.y movement.y))))
// don't move the ui camera before ui has been placed -- new UI elements could appear offscreen
(when (> uiGroup.length 0)