mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 02:59:19 +01:00
Add HOME button to reset camera position
This commit is contained in:
parent
74b498bdfb
commit
906f129901
@ -238,10 +238,7 @@ class WorkspaceView extends Widget with Persistable with DragHandler with ClickH
|
|||||||
|
|
||||||
eventHandlers += {
|
eventHandlers += {
|
||||||
case ev@DragEvent(DragEvent.State.Drag, MouseEvent.Button.Left | MouseEvent.Button.Middle, _) =>
|
case ev@DragEvent(DragEvent.State.Drag, MouseEvent.Button.Left | MouseEvent.Button.Middle, _) =>
|
||||||
cameraOffset += ev.delta
|
moveCameraOffset(ev.delta)
|
||||||
for (node <- nodes)
|
|
||||||
node.position += ev.delta
|
|
||||||
windowPool.movePinnedWindows(ev.delta)
|
|
||||||
|
|
||||||
case ClickEvent(MouseEvent.Button.Left | MouseEvent.Button.Right, pos) =>
|
case ClickEvent(MouseEvent.Button.Left | MouseEvent.Button.Right, pos) =>
|
||||||
if (nodeSelector.isClosed) {
|
if (nodeSelector.isClosed) {
|
||||||
@ -269,6 +266,16 @@ class WorkspaceView extends Widget with Persistable with DragHandler with ClickH
|
|||||||
|
|
||||||
case KeyEvent(KeyEvent.State.Press, Keyboard.KEY_F4, _) =>
|
case KeyEvent(KeyEvent.State.Press, Keyboard.KEY_F4, _) =>
|
||||||
profilerWindow.open()
|
profilerWindow.open()
|
||||||
|
|
||||||
|
case KeyEvent(KeyEvent.State.Press, Keyboard.KEY_HOME, _) =>
|
||||||
|
moveCameraOffset(-cameraOffset)
|
||||||
|
}
|
||||||
|
|
||||||
|
private def moveCameraOffset(delta: Vector2D): Unit = {
|
||||||
|
cameraOffset += delta
|
||||||
|
for (node <- nodes)
|
||||||
|
node.position += delta
|
||||||
|
windowPool.movePinnedWindows(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
private def openSelector(p: Vector2D): Unit = {
|
private def openSelector(p: Vector2D): Unit = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user