diff --git a/src/main/kotlin/solve/rendering/canvas/SceneCanvas.kt b/src/main/kotlin/solve/rendering/canvas/SceneCanvas.kt index b8c8fd87..3c7f6268 100644 --- a/src/main/kotlin/solve/rendering/canvas/SceneCanvas.kt +++ b/src/main/kotlin/solve/rendering/canvas/SceneCanvas.kt @@ -46,19 +46,22 @@ class SceneCanvas : OpenGLCanvas() { } private val mouseDraggedEventHandler = EventHandler { event -> val mousePosition = extrudeEventMousePosition(event) - if (event.button == MouseButton.MIDDLE) + if (event.button == MouseButton.MIDDLE) { onMouseDragged(mousePosition) + } } private val wheelPressedEventHandler = EventHandler { event -> - if (event.button != MouseButton.MIDDLE) + if (event.button != MouseButton.MIDDLE) { return@EventHandler + } dragStartCameraPosition = window.camera.position dragStartPoint = fromScreenToCameraPoint(mousePosition) isDraggingScene = true } private val wheelReleasedEventHandler = EventHandler { event -> - if (event.button != MouseButton.MIDDLE) + if (event.button != MouseButton.MIDDLE) { return@EventHandler + } isDraggingScene = false } diff --git a/src/main/kotlin/solve/rendering/engine/rendering/renderers/FramesRenderer.kt b/src/main/kotlin/solve/rendering/engine/rendering/renderers/FramesRenderer.kt index 6ad45932..5b55adae 100644 --- a/src/main/kotlin/solve/rendering/engine/rendering/renderers/FramesRenderer.kt +++ b/src/main/kotlin/solve/rendering/engine/rendering/renderers/FramesRenderer.kt @@ -22,7 +22,6 @@ import solve.rendering.engine.shader.ShaderType import solve.rendering.engine.structures.IntRect import solve.rendering.engine.utils.minus import solve.rendering.engine.utils.toIntVector -import solve.scene.controller.SceneController import solve.scene.model.VisualizationFrame import solve.utils.ceilToInt import kotlin.math.abs @@ -70,8 +69,9 @@ class FramesRenderer( } fun setFramesSelection(frames: List) { - if (frames.isEmpty()) + if (frames.isEmpty()) { return + } this.selectedFrames = frames haveNewFramesSelection = true @@ -106,11 +106,13 @@ class FramesRenderer( } override fun beforeRender() { - if (selectedFrames.isEmpty()) + if (selectedFrames.isEmpty()) { return + } - if (needToReinitializeBuffers) + if (needToReinitializeBuffers) { reinitializeBuffers() + } if (haveNewFramesSelection) { uploadAllFramesToBuffer()