playground don't move camera when textinput has focus
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user