diff --git a/js/ui/dnd.js b/js/ui/dnd.js index f6debef58..6f5524107 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -455,20 +455,29 @@ var _Draggable = class _Draggable { scale_y: scale * origScale, duration: SCALE_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_QUAD, + onComplete: () => { + this._updateActorPosition(origScale, + origDragOffsetX, origDragOffsetY, transX, transY); + }, }); this._dragActor.get_transition('scale-x').connect('new-frame', () => { - let currentScale = this._dragActor.scale_x / origScale; - this._dragOffsetX = currentScale * origDragOffsetX - transX; - this._dragOffsetY = currentScale * origDragOffsetY - transY; - this._dragActor.set_position( - this._dragX + this._dragOffsetX, - this._dragY + this._dragOffsetY); + this._updateActorPosition(origScale, + origDragOffsetX, origDragOffsetY, transX, transY); }); } } } + _updateActorPosition(origScale, origDragOffsetX, origDragOffsetY, transX, transY) { + const currentScale = this._dragActor.scale_x / origScale; + this._dragOffsetX = currentScale * origDragOffsetX - transX; + this._dragOffsetY = currentScale * origDragOffsetY - transY; + this._dragActor.set_position( + this._dragX + this._dragOffsetX, + this._dragY + this._dragOffsetY); + } + _maybeStartDrag(event) { let [stageX, stageY] = event.get_coords();