effects: Properly copy previous geometry

In QJSEngine, QRect is an Object, which is correct. This means that we
cannot use simple assignment operator to copy geometries, we need to use
standard ways to copy Objects, such as Object.assign() or the spread
operator, which is not available in QJSEngine yet.
This commit is contained in:
Vlad Zahorodnii 2021-02-22 10:04:28 +02:00
parent bd4d17b3a1
commit 33ba2974eb
2 changed files with 6 additions and 6 deletions

View file

@ -21,7 +21,7 @@ var fullScreenEffect = {
var oldGeometry, newGeometry;
oldGeometry = window.oldGeometry;
newGeometry = window.geometry;
window.oldGeometry = newGeometry;
window.oldGeometry = Object.assign({}, newGeometry);
window.fullScreenAnimation1 = animate({
window: window,
duration: fullScreenEffect.duration,
@ -77,7 +77,7 @@ var fullScreenEffect = {
}
}
}
window.oldGeometry = window.geometry;
window.oldGeometry = Object.assign({}, window.geometry);
},
init: function () {
effect.configChanged.connect(fullScreenEffect.loadConfig);

View file

@ -23,8 +23,8 @@ var maximizeEffect = {
newGeometry = window.geometry;
if (oldGeometry.width == newGeometry.width && oldGeometry.height == newGeometry.height)
oldGeometry = window.olderGeometry;
window.olderGeometry = window.oldGeometry;
window.oldGeometry = newGeometry;
window.olderGeometry = Object.assign({}, window.oldGeometry);
window.oldGeometry = Object.assign({}, newGeometry);
window.maximizeAnimation1 = animate({
window: window,
duration: maximizeEffect.duration,
@ -80,8 +80,8 @@ var maximizeEffect = {
}
}
}
window.oldGeometry = window.geometry;
window.olderGeometry = oldGeometry;
window.oldGeometry = Object.assign({}, window.geometry);
window.olderGeometry = Object.assign({}, oldGeometry);
},
init: function () {
effect.configChanged.connect(maximizeEffect.loadConfig);