[orx-camera] Add propagationCancelled checks

This commit is contained in:
Edwin Jakobs
2023-07-11 16:16:33 +02:00
parent ddb308bb9b
commit 12da813b09

View File

@@ -43,6 +43,7 @@ class Camera2D : Extension, ChangeEvents {
rotationCenter = it.position
}
mouse.dragged.listen {
if (!it.propagationCancelled) {
when (it.button) {
MouseButton.LEFT -> view = buildTransform {
translate(it.dragDisplacement)
@@ -58,7 +59,9 @@ class Camera2D : Extension, ChangeEvents {
}
dirty = true
}
}
mouse.scrolled.listen {
if (!it.propagationCancelled) {
val scaleFactor = 1.0 - it.rotation.y * 0.03
view = buildTransform {
translate(it.position)
@@ -68,6 +71,7 @@ class Camera2D : Extension, ChangeEvents {
dirty = true
}
}
}
override fun setup(program: Program) {
setupMouseEvents(program.mouse)