mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Zoom label now shows the correct zoom value on smooth zoom
This commit is contained in:
parent
53a9719230
commit
cba301f911
|
@ -55,6 +55,7 @@ Martin Novák (novhack), luiq54, Schweini07, Marco Galli (Gaarco), Matheus Peseg
|
||||||
- Fixed issue with LineEdits not letting go of focus when the user clicked somewhere else.! (Issue #167)
|
- Fixed issue with LineEdits not letting go of focus when the user clicked somewhere else.! (Issue #167)
|
||||||
- When the palette, outline and rotate image dialogs are open, the user can't zoom in the canvas anymore.
|
- When the palette, outline and rotate image dialogs are open, the user can't zoom in the canvas anymore.
|
||||||
- Fixed bug where the user could drag the selection and the guides when the canvas had no focus.
|
- Fixed bug where the user could drag the selection and the guides when the canvas had no focus.
|
||||||
|
- The zoom label on the top bar now shows the correct zoom value when smooth zoom is enabled.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- It's no longer possible for frames to have different amounts of layers. All frames have the same amount.
|
- It's no longer possible for frames to have different amounts of layers. All frames have the same amount.
|
||||||
|
|
|
@ -42,6 +42,7 @@ func is_action_direction_pressed(event : InputEvent, allow_echo: bool = true) ->
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
||||||
# Check if an event is a ui_up/down/left/right event release nya
|
# Check if an event is a ui_up/down/left/right event release nya
|
||||||
func is_action_direction_released(event: InputEvent) -> bool:
|
func is_action_direction_released(event: InputEvent) -> bool:
|
||||||
for action in key_move_action_names:
|
for action in key_move_action_names:
|
||||||
|
@ -49,6 +50,7 @@ func is_action_direction_released(event: InputEvent) -> bool:
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
||||||
# get the Direction associated with the event.
|
# get the Direction associated with the event.
|
||||||
# if not a direction event return null
|
# if not a direction event return null
|
||||||
func get_action_direction(event: InputEvent): # -> Optional[Direction]
|
func get_action_direction(event: InputEvent): # -> Optional[Direction]
|
||||||
|
@ -62,6 +64,7 @@ func get_action_direction(event: InputEvent): # -> Optional[Direction]
|
||||||
return Global.Direction.RIGHT
|
return Global.Direction.RIGHT
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|
||||||
# Holds sign multipliers for the given directions nyaa
|
# Holds sign multipliers for the given directions nyaa
|
||||||
# (per the indices in Global.gd defined by Direction)
|
# (per the indices in Global.gd defined by Direction)
|
||||||
# UP, DOWN, LEFT, RIGHT in that order
|
# UP, DOWN, LEFT, RIGHT in that order
|
||||||
|
@ -85,6 +88,7 @@ func process_direction_action_pressed(event: InputEvent) -> void:
|
||||||
var move_speed := dir_move_zoom_multiplier(this_direction_press_time)
|
var move_speed := dir_move_zoom_multiplier(this_direction_press_time)
|
||||||
offset = offset + move_speed * increment * directional_sign_multipliers[dir] * zoom
|
offset = offset + move_speed * increment * directional_sign_multipliers[dir] * zoom
|
||||||
|
|
||||||
|
|
||||||
# Process an action for a release direction action
|
# Process an action for a release direction action
|
||||||
func process_direction_action_released(event: InputEvent) -> void:
|
func process_direction_action_released(event: InputEvent) -> void:
|
||||||
var dir = get_action_direction(event)
|
var dir = get_action_direction(event)
|
||||||
|
@ -92,6 +96,7 @@ func process_direction_action_released(event: InputEvent) -> void:
|
||||||
return
|
return
|
||||||
reset_dir_move_time(dir)
|
reset_dir_move_time(dir)
|
||||||
|
|
||||||
|
|
||||||
func _input(event : InputEvent) -> void:
|
func _input(event : InputEvent) -> void:
|
||||||
mouse_pos = viewport_container.get_local_mouse_position()
|
mouse_pos = viewport_container.get_local_mouse_position()
|
||||||
var viewport_size := viewport_container.rect_size
|
var viewport_size := viewport_container.rect_size
|
||||||
|
@ -125,6 +130,9 @@ func zoom_camera(dir : int) -> void:
|
||||||
tween.interpolate_property(self, "offset", offset, new_offset, 0.05, Tween.TRANS_LINEAR, Tween.EASE_IN)
|
tween.interpolate_property(self, "offset", offset, new_offset, 0.05, Tween.TRANS_LINEAR, Tween.EASE_IN)
|
||||||
tween.start()
|
tween.start()
|
||||||
|
|
||||||
|
if name == "Camera2D":
|
||||||
|
Global.zoom_level_label.text = str(round(100 / new_zoom.x)) + " %"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
var prev_zoom := zoom
|
var prev_zoom := zoom
|
||||||
var zoom_margin = zoom * dir / 10
|
var zoom_margin = zoom * dir / 10
|
||||||
|
@ -135,6 +143,5 @@ func zoom_camera(dir : int) -> void:
|
||||||
zoom = zoom_max
|
zoom = zoom_max
|
||||||
|
|
||||||
offset = offset + (-0.5 * viewport_size + mouse_pos) * (prev_zoom - zoom)
|
offset = offset + (-0.5 * viewport_size + mouse_pos) * (prev_zoom - zoom)
|
||||||
|
|
||||||
if name == "Camera2D":
|
if name == "Camera2D":
|
||||||
Global.zoom_level_label.text = str(round(100 / Global.camera.zoom.x)) + " %"
|
Global.zoom_level_label.text = str(round(100 / Global.camera.zoom.x)) + " %"
|
||||||
|
|
Loading…
Reference in a new issue