From 33ba2974ebb510da15c30f778e9e7a917d8eaba1 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 22 Feb 2021 10:04:28 +0200 Subject: [PATCH] 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. --- .../fullscreen/package/contents/code/fullscreen.js | 4 ++-- src/effects/maximize/package/contents/code/maximize.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/effects/fullscreen/package/contents/code/fullscreen.js b/src/effects/fullscreen/package/contents/code/fullscreen.js index d1926524da..ff03028852 100644 --- a/src/effects/fullscreen/package/contents/code/fullscreen.js +++ b/src/effects/fullscreen/package/contents/code/fullscreen.js @@ -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); diff --git a/src/effects/maximize/package/contents/code/maximize.js b/src/effects/maximize/package/contents/code/maximize.js index 931b3bcfef..1aa743cbfb 100644 --- a/src/effects/maximize/package/contents/code/maximize.js +++ b/src/effects/maximize/package/contents/code/maximize.js @@ -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);