Skip to content

Commit

Permalink
update identity scale calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
mi-sts committed Jun 9, 2024
1 parent c438980 commit 10b9b70
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 1 addition & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ application {
"--add-opens", "javafx.graphics/javafx.scene.image=ALL-UNNAMED",
"--add-exports", "javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED",
"-Xms2g",
"-Xmx4g",
"-Dglass.win.uiScale=1.0",
"-Dsun.java2d.uiScale=1.0"
"-Xmx4g"
)
}

Expand Down
10 changes: 6 additions & 4 deletions src/main/kotlin/solve/rendering/canvas/SceneCanvas.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ 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
Expand Down Expand Up @@ -47,6 +46,11 @@ import solve.rendering.engine.scene.Scene as EngineScene
* Provides interface for managing frames and changing visualization settings.
*/
class SceneCanvas : OpenGLCanvas() {
val scaledIdentityFramesSizeScale: Float
get() {
return IdentityFramesSizeScale * (canvas.scene?.window?.renderScaleX?.toFloat() ?: 1f)
}

private var sceneController: SceneController? = null
private var engineScene: EngineScene? = null

Expand Down Expand Up @@ -83,6 +87,7 @@ class SceneCanvas : OpenGLCanvas() {

init {
initializeCanvasEvents()
ServiceLocator.registerService(this)
}

fun setNewScene(scene: Scene) {
Expand Down Expand Up @@ -485,9 +490,6 @@ 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

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/solve/scene/controller/SceneController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class SceneController : Controller() {
max(
installedMinScale,
sceneWidthProperty.value / ((scene.frameSize.width + SceneView.framesMargin) * columnsNumber) *
SceneCanvas.scaledIdentityFramesSizeScale
(ServiceLocator.getService<SceneCanvas>()?.scaledIdentityFramesSizeScale ?: 1f)
),
DefaultMaxScale
)
Expand Down

0 comments on commit 10b9b70

Please sign in to comment.