mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-30 23:19:49 +00:00
Improved the "fit to frame" zoom button
The resulting camera zoom now depends on the window size. More specifically, the main viewport's x size. This formula is purely trial-and-error, and it may not work perfectly, or properly for some screen sizes. If anyone wants to improve it, feel free to do so!
This commit is contained in:
parent
7d2b15cc0b
commit
bdd3cdf45e
|
@ -654,7 +654,7 @@ func _on_RightZoomModeOptions_item_selected(ID : int) -> void:
|
|||
|
||||
func _on_FitToFrameButton_pressed() -> void:
|
||||
var bigger = max(Global.canvas.size.x, Global.canvas.size.y)
|
||||
Global.camera.zoom = Vector2(bigger, bigger) * 0.002
|
||||
Global.camera.zoom = (Vector2(bigger, bigger) * 0.004) / (Global.main_viewport.rect_size.x * 0.002)
|
||||
Global.camera.offset = Global.canvas.size / 2
|
||||
Global.zoom_level_label.text = str(round(100 / Global.camera.zoom.x)) + " %"
|
||||
|
||||
|
|
Loading…
Reference in a new issue