WindowClone: Don't calculate offset (#1567)

This commit is contained in:
Leo 2023-03-19 13:16:44 +09:00 committed by GitHub
parent c789d9118b
commit b7139add23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,8 +132,6 @@ public class Gala.WindowClone : Clutter.Actor {
window_icon = new WindowIcon (window, WINDOW_ICON_SIZE, scale_factor);
window_icon.opacity = 0;
window_icon.set_pivot_point (0.5f, 0.5f);
window_icon.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
window_icon.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
set_window_icon_position (window_frame_rect.width, window_frame_rect.height);
window_title = new Tooltip ();
@ -271,10 +269,6 @@ public class Gala.WindowClone : Clutter.Actor {
in_slot_animation = true;
place_widgets (outer_rect.width, outer_rect.height);
GestureTracker.OnBegin on_animation_begin = () => {
window_icon.set_easing_duration (0);
};
GestureTracker.OnUpdate on_animation_update = (percentage) => {
var x = GestureTracker.animation_value (initial_x, target_x, percentage);
var y = GestureTracker.animation_value (initial_y, target_y, percentage);
@ -333,10 +327,9 @@ public class Gala.WindowClone : Clutter.Actor {
};
if (!animate || gesture_tracker == null || !with_gesture) {
on_animation_begin (0);
on_animation_end (1, false, 0);
} else {
gesture_tracker.connect_handlers ((owned) on_animation_begin, (owned) on_animation_update, (owned) on_animation_end);
gesture_tracker.connect_handlers (null, (owned) on_animation_update, (owned) on_animation_end);
}
}
@ -440,19 +433,8 @@ public class Gala.WindowClone : Clutter.Actor {
}
clone.set_scale (scale_factor, scale_factor);
// Scaling happens around the pivot point, so we need to move the clone
// to compensate for the difference between the pivot point and the
// top left corner of the clone.
float pivot_x, pivot_y;
clone.get_pivot_point (out pivot_x, out pivot_y);
var absolute_pivot_x = pivot_x * clone.width;
var absolute_pivot_y = pivot_y * clone.height;
var x_offset = absolute_pivot_x * (scale_factor - 1);
var y_offset = absolute_pivot_y * (scale_factor - 1);
clone.set_position ((input_rect.x - outer_rect.x) * scale_factor + x_offset,
(input_rect.y - outer_rect.y) * scale_factor + y_offset);
clone.set_position ((input_rect.x - outer_rect.x) * scale_factor,
(input_rect.y - outer_rect.y) * scale_factor);
}
public override bool button_press_event (Clutter.ButtonEvent event) {
@ -772,7 +754,7 @@ public class Gala.WindowClone : Clutter.Actor {
prev_parent.insert_child_at_index (this, prev_index);
clone.save_easing_state ();
clone.set_pivot_point (0.5f, 0.5f);
clone.set_pivot_point (0.0f, 0.0f);
clone.set_easing_duration (250);
clone.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
clone.set_scale (1, 1);