diff --git a/src/main/kotlin/solve/rendering/canvas/SceneCanvas.kt b/src/main/kotlin/solve/rendering/canvas/SceneCanvas.kt index 1b0ba203..f012f8db 100644 --- a/src/main/kotlin/solve/rendering/canvas/SceneCanvas.kt +++ b/src/main/kotlin/solve/rendering/canvas/SceneCanvas.kt @@ -4,6 +4,7 @@ import io.github.palexdev.materialfx.controls.MFXContextMenu import javafx.scene.Node import javafx.scene.input.Clipboard import javafx.scene.input.ClipboardContent +import javafx.stage.Screen import org.joml.Vector2f import org.joml.Vector2i import solve.parsers.planes.ImagePlanesParser @@ -371,7 +372,7 @@ class SceneCanvas : OpenGLCanvas() { rowsNumber * framesSize.y + (rowsNumber - 1) * Renderer.getSpacingWidth(framesSize) ) val framesSelectionScreenSize = - framesSelectionSize * window.camera.zoom / IdentityFramesSizeScale / window.camera.scaledZoom + framesSelectionSize * window.camera.zoom / scaledIdentityFramesSizeScale / window.camera.scaledZoom rightLowerCornerCameraPosition = framesSelectionScreenSize - leftUpperCornerCameraPosition @@ -450,7 +451,7 @@ class SceneCanvas : OpenGLCanvas() { ) } val getScreenScale = { - window.camera.zoom.toDouble() / IdentityFramesSizeScale + window.camera.zoom.toDouble() / scaledIdentityFramesSizeScale } val associationAdorner = AssociationAdorner( framesSize.x.toDouble(), @@ -484,6 +485,9 @@ class SceneCanvas : OpenGLCanvas() { companion object { const val IdentityFramesSizeScale = 1.605f + val scaledIdentityFramesSizeScale: Float + get() = IdentityFramesSizeScale * Screen.getPrimary().outputScaleX.toFloat() + private val landmarkInteractionMouseButton = MouseButton.Left private val contextMenuMouseButton = MouseButton.Right diff --git a/src/main/kotlin/solve/scene/controller/SceneController.kt b/src/main/kotlin/solve/scene/controller/SceneController.kt index 7c6970d1..fa3009b1 100644 --- a/src/main/kotlin/solve/scene/controller/SceneController.kt +++ b/src/main/kotlin/solve/scene/controller/SceneController.kt @@ -198,7 +198,7 @@ class SceneController : Controller() { max( installedMinScale, sceneWidthProperty.value / ((scene.frameSize.width + SceneView.framesMargin) * columnsNumber) * - SceneCanvas.IdentityFramesSizeScale + SceneCanvas.scaledIdentityFramesSizeScale ), DefaultMaxScale ) diff --git a/src/main/kotlin/solve/scene/view/SceneView.kt b/src/main/kotlin/solve/scene/view/SceneView.kt index 2caa6a14..346e0ba5 100644 --- a/src/main/kotlin/solve/scene/view/SceneView.kt +++ b/src/main/kotlin/solve/scene/view/SceneView.kt @@ -24,7 +24,6 @@ class SceneView : View() { private var mouseScreenPoint = Vector2i() private var wasMouseDragging = false - private var screen = Screen.getPrimary() override val root = canvas.canvas @@ -41,6 +40,7 @@ class SceneView : View() { } private fun extrudeEventMousePosition(event: MouseEvent) : Vector2i { + val screen = Screen.getPrimary() return Vector2i( (event.x * screen.outputScaleX).toInt(), (event.y * screen.outputScaleY).toInt()