Skip to content

Commit

Permalink
codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
mi-sts committed Nov 24, 2023
1 parent a767a20 commit f580219
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/main/kotlin/solve/rendering/canvas/SceneCanvas.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,22 @@ class SceneCanvas : OpenGLCanvas() {
}
private val mouseDraggedEventHandler = EventHandler<MouseEvent> { event ->
val mousePosition = extrudeEventMousePosition(event)
if (event.button == MouseButton.MIDDLE)
if (event.button == MouseButton.MIDDLE) {
onMouseDragged(mousePosition)
}
}
private val wheelPressedEventHandler = EventHandler<MouseEvent> { 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<MouseEvent> { event ->
if (event.button != MouseButton.MIDDLE)
if (event.button != MouseButton.MIDDLE) {
return@EventHandler
}
isDraggingScene = false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -70,8 +69,9 @@ class FramesRenderer(
}

fun setFramesSelection(frames: List<VisualizationFrame>) {
if (frames.isEmpty())
if (frames.isEmpty()) {
return
}

this.selectedFrames = frames
haveNewFramesSelection = true
Expand Down Expand Up @@ -106,11 +106,13 @@ class FramesRenderer(
}

override fun beforeRender() {
if (selectedFrames.isEmpty())
if (selectedFrames.isEmpty()) {
return
}

if (needToReinitializeBuffers)
if (needToReinitializeBuffers) {
reinitializeBuffers()
}

if (haveNewFramesSelection) {
uploadAllFramesToBuffer()
Expand Down

0 comments on commit f580219

Please sign in to comment.