Skip to content

Commit

Permalink
another scale method fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qdwang committed Aug 20, 2021
1 parent b2d9ba1 commit a92cfc9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions GUI/Scene/PhotoFrame.gd
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,11 @@ func rescale(is_scale_up, index = -1, reposition_center = false):
var factor = scale_options[scale_index]

$Photo.scale = Vector2(factor, factor)
if prev_scale_index == 0 and scale_index == 1:
if Settings.zoom_at_af_point and $Photo/FocusPos.visible:
reposition((1 if $Photo.rotation_degrees == 180 else -1) * $Photo/FocusPos.position)
else:
var pos = rect_min_size / 2 if reposition_center else Util.Nodes["Grid"].cursor_pos_in_frame
reposition(($Photo.position - pos) * (factor / pre_factor) + rect_min_size / 2 - $Photo.position)
if Settings.zoom_at_af_point and $Photo/FocusPos.visible and prev_scale_index == 0 and scale_index == 1:
reposition((1 if $Photo.rotation_degrees == 180 else -1) * $Photo/FocusPos.position)
else:
reposition(($Photo.position - rect_min_size / 2) * (factor / pre_factor - 1))
var pos = rect_min_size / 2 if reposition_center else Util.Nodes["Grid"].cursor_pos_in_frame
reposition(($Photo.position - pos) * (factor / pre_factor) - ($Photo.position - pos))


func reposition(pos):
Expand Down

0 comments on commit a92cfc9

Please sign in to comment.