[gnome-shell] dnd: Get transformed size for scaling before unparenting drag actor



commit d19683a84ce49c129ea867fde9f1d57c36c85b3a
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Wed Oct 21 01:02:37 2020 +0200

    dnd: Get transformed size for scaling before unparenting drag actor
    
    Commit de610a13f1ad1e7e34d4b9a81df58d4da3693059 in mutter made it
    impossible to access the actors last allocation after unmapping it,
    this broke the scale-up/down animation when starting a drag.
    
    Fix that animation again by saving the actors transformed size before
    unparenting (and therefore unmapping) the actor instead of afterwards.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1475

 js/ui/dnd.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index b1e1680f43..f6debef584 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -338,6 +338,8 @@ var _Draggable = class _Draggable {
         this._dragX = this._dragStartX = stageX;
         this._dragY = this._dragStartY = stageY;
 
+        let scaledWidth, scaledHeight;
+
         if (this.actor._delegate && this.actor._delegate.getDragActor) {
             this._dragActor = this.actor._delegate.getDragActor();
             Main.uiGroup.add_child(this._dragActor);
@@ -370,6 +372,8 @@ var _Draggable = class _Draggable {
 
             this._dragOffsetX = this._dragActor.x - this._dragStartX;
             this._dragOffsetY = this._dragActor.y - this._dragStartY;
+
+            [scaledWidth, scaledHeight] = this._dragActor.get_transformed_size();
         } else {
             this._dragActor = this.actor;
 
@@ -399,6 +403,9 @@ var _Draggable = class _Draggable {
             this._dragOffsetX = transformedExtents.origin.x - this._dragStartX;
             this._dragOffsetY = transformedExtents.origin.y - this._dragStartY;
 
+            scaledWidth = transformedExtents.get_width();
+            scaledHeight = transformedExtents.get_height();
+
             this._dragOrigParent.remove_actor(this._dragActor);
             Main.uiGroup.add_child(this._dragActor);
             Main.uiGroup.set_child_above_sibling(this._dragActor, null);
@@ -432,7 +439,6 @@ var _Draggable = class _Draggable {
             this._dragY + this._dragOffsetY);
 
         if (this._dragActorMaxSize != undefined) {
-            let [scaledWidth, scaledHeight] = this._dragActor.get_transformed_size();
             let currentSize = Math.max(scaledWidth, scaledHeight);
             if (currentSize > this._dragActorMaxSize) {
                 let scale = this._dragActorMaxSize / currentSize;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]