From 3ba27f383fb556a177c716b695699b84b90afc28 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Tue, 21 Nov 2023 18:08:39 +0100 Subject: [PATCH 1/2] :beetle: Fix issue #404 --- src/effects/Incinerate.js | 16 ++++++++-------- src/effects/PixelWipe.js | 19 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/effects/Incinerate.js b/src/effects/Incinerate.js index 0f5cd09..589bf75 100644 --- a/src/effects/Incinerate.js +++ b/src/effects/Incinerate.js @@ -58,8 +58,8 @@ export default class Effect { // position may change after the begin-animation signal is called, we set the // uStartPos uniform during the update callback. if (settings.get_boolean('incinerate-use-pointer')) { - this._startPointerPos = global.get_pointer(); - this._actor = actor; + shader._startPointerPos = global.get_pointer(); + shader._actor = actor; } else { // Else, a random position along the window boundary is used as start position @@ -69,7 +69,7 @@ export default class Effect { shader.set_uniform_float(shader._uStartPos, 2, startPos); - this._startPointerPos = null; + shader._startPointerPos = null; } const c = Clutter.Color.from_string(settings.get_string('incinerate-color'))[1]; @@ -86,14 +86,14 @@ export default class Effect { // uniform during the update callback as the actor position may not be set up // properly before the begin animation callback. shader.connect('update-animation', (shader) => { - if (this._startPointerPos) { - const [x, y] = this._startPointerPos; - const [ok, localX, localY] = this._actor.transform_stage_point(x, y); + if (shader._startPointerPos) { + const [x, y] = shader._startPointerPos; + const [ok, localX, localY] = shader._actor.transform_stage_point(x, y); if (ok) { let startPos = [ - Math.max(0.0, Math.min(1.0, localX / this._actor.width)), - Math.max(0.0, Math.min(1.0, localY / this._actor.height)) + Math.max(0.0, Math.min(1.0, localX / shader._actor.width)), + Math.max(0.0, Math.min(1.0, localY / shader._actor.height)) ]; shader.set_uniform_float(shader._uStartPos, 2, startPos); } diff --git a/src/effects/PixelWipe.js b/src/effects/PixelWipe.js index 9d33df8..6f9a3bc 100644 --- a/src/effects/PixelWipe.js +++ b/src/effects/PixelWipe.js @@ -48,25 +48,24 @@ export default class Effect { 'begin-animation', (shader, settings, forOpening, testMode, actor) => { // Because the actor position may change after the begin-animation signal is // called, we set the uStartPos uniform during the update callback. - this._startPointerPos = global.get_pointer(); - this._actor = actor; + shader._startPointerPos = global.get_pointer(); + shader._actor = actor; - // clang-format off - shader.set_uniform_float(shader._uPixelSize, 1, [settings.get_int('pixel-wipe-pixel-size')]); - // clang-format on + shader.set_uniform_float(shader._uPixelSize, 1, + [settings.get_int('pixel-wipe-pixel-size')]); }); // We set the uStartPos uniform during the update callback as the actor position // may not be set up properly before the begin animation callback. shader.connect('update-animation', (shader) => { - if (this._startPointerPos) { - const [x, y] = this._startPointerPos; - const [ok, localX, localY] = this._actor.transform_stage_point(x, y); + if (shader._startPointerPos) { + const [x, y] = shader._startPointerPos; + const [ok, localX, localY] = shader._actor.transform_stage_point(x, y); if (ok) { let startPos = [ - Math.max(0.0, Math.min(1.0, localX / this._actor.width)), - Math.max(0.0, Math.min(1.0, localY / this._actor.height)) + Math.max(0.0, Math.min(1.0, localX / shader._actor.width)), + Math.max(0.0, Math.min(1.0, localY / shader._actor.height)) ]; shader.set_uniform_float(shader._uStartPos, 2, startPos); } From 5216e460cb64a7a0efc67e36c68734a9e3946c78 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Tue, 21 Nov 2023 18:09:53 +0100 Subject: [PATCH 2/2] :memo: Add changelog entries --- docs/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.md b/docs/changelog.md index 4b5a3e1..d1da299 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -12,6 +12,7 @@ SPDX-License-Identifier: CC-BY-4.0 #### Bug Fixes - Fixed a compatibility issue with Plasma 6. Thanks to [@CoelacanthusHex](https://github.com/CoelacanthusHex) for the fix! +- Fixed an issue which caused the origin of the Incinerate and Pixel Wipe effects to be reset to the current mouse position whenever another effect was started while an effect was still running. ## [Burn My Windows 40 [backport release]](https://github.com/schneegans/Burn-My-Windows/releases/tag/v40)