|
|
|
|
@ -18,15 +18,28 @@ You should have received a copy of the GNU General Public License |
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*********************************************************************/ |
|
|
|
|
/*global effect, effects, animate, animationTime, Effect*/ |
|
|
|
|
var panHelperEffect = { |
|
|
|
|
duration: animationTime(250), |
|
|
|
|
class panHelperEffect { |
|
|
|
|
constructor() { |
|
|
|
|
effect.configChanged.connect(this.loadConfig.bind(this)); |
|
|
|
|
|
|
|
|
|
loadConfig: function () { |
|
|
|
|
effects.windowAdded.connect(this.manage.bind(this)); |
|
|
|
|
for (const window of effects.stackingOrder) { |
|
|
|
|
this.manage(window); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.loadConfig(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
loadConfig() { |
|
|
|
|
"use strict"; |
|
|
|
|
panHelperEffect.duration = animationTime(250); |
|
|
|
|
}, |
|
|
|
|
this.duration = animationTime(250); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
geometryChange: function (window, oldGeometry) { |
|
|
|
|
manage(window) { |
|
|
|
|
window.windowFrameGeometryChanged.connect(this.geometryChange.bind(this)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
geometryChange(window, oldGeometry) { |
|
|
|
|
"use strict"; |
|
|
|
|
|
|
|
|
|
var newGeometry = window.geometry; |
|
|
|
|
@ -45,7 +58,7 @@ var panHelperEffect = { |
|
|
|
|
// ignore
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if (((distx != 0 ) && (distx < newGeometry.width / 6)) || |
|
|
|
|
if (((distx != 0 ) && (distx < newGeometry.width / 6)) || |
|
|
|
|
((disty != 0 ) && (disty < newGeometry.height / 6))) { |
|
|
|
|
if (window.moveAnimation) { |
|
|
|
|
delete window.moveAnimation; |
|
|
|
|
@ -59,13 +72,13 @@ var panHelperEffect = { |
|
|
|
|
couldRetarget = retarget(window.moveAnimation[0], { |
|
|
|
|
value1: newGeometry.width, |
|
|
|
|
value2: newGeometry.height |
|
|
|
|
}, panHelperEffect.duration); |
|
|
|
|
}, this.duration); |
|
|
|
|
} |
|
|
|
|
if (couldRetarget && window.moveAnimation[1]) { |
|
|
|
|
couldRetarget = retarget(window.moveAnimation[1], { |
|
|
|
|
value1: newGeometry.x + newGeometry.width / 2, |
|
|
|
|
value2: newGeometry.y + newGeometry.height / 2 |
|
|
|
|
}, panHelperEffect.duration); |
|
|
|
|
}, this.duration); |
|
|
|
|
} |
|
|
|
|
if (!couldRetarget) { |
|
|
|
|
cancel(window.moveAnimation[0]); |
|
|
|
|
@ -77,7 +90,7 @@ var panHelperEffect = { |
|
|
|
|
if (!couldRetarget) { |
|
|
|
|
window.moveAnimation = animate({ |
|
|
|
|
window: window, |
|
|
|
|
duration: panHelperEffect.duration, |
|
|
|
|
duration: this.duration, |
|
|
|
|
animations: [{ |
|
|
|
|
type: Effect.Size, |
|
|
|
|
curve: QEasingCurve.OutCubic, |
|
|
|
|
@ -103,12 +116,7 @@ var panHelperEffect = { |
|
|
|
|
}] |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
init: function () { |
|
|
|
|
"use strict"; |
|
|
|
|
effect.configChanged.connect(panHelperEffect.loadConfig); |
|
|
|
|
effects.windowGeometryShapeChanged.connect(panHelperEffect.geometryChange); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
panHelperEffect.init(); |
|
|
|
|
} |
|
|
|
|
new panHelperEffect(); |