🪲 Fix issue #404
This commit is contained in:
@@ -58,8 +58,8 @@ export default class Effect {
|
|||||||
// position may change after the begin-animation signal is called, we set the
|
// position may change after the begin-animation signal is called, we set the
|
||||||
// uStartPos uniform during the update callback.
|
// uStartPos uniform during the update callback.
|
||||||
if (settings.get_boolean('incinerate-use-pointer')) {
|
if (settings.get_boolean('incinerate-use-pointer')) {
|
||||||
this._startPointerPos = global.get_pointer();
|
shader._startPointerPos = global.get_pointer();
|
||||||
this._actor = actor;
|
shader._actor = actor;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Else, a random position along the window boundary is used as start position
|
// 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);
|
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];
|
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
|
// uniform during the update callback as the actor position may not be set up
|
||||||
// properly before the begin animation callback.
|
// properly before the begin animation callback.
|
||||||
shader.connect('update-animation', (shader) => {
|
shader.connect('update-animation', (shader) => {
|
||||||
if (this._startPointerPos) {
|
if (shader._startPointerPos) {
|
||||||
const [x, y] = this._startPointerPos;
|
const [x, y] = shader._startPointerPos;
|
||||||
const [ok, localX, localY] = this._actor.transform_stage_point(x, y);
|
const [ok, localX, localY] = shader._actor.transform_stage_point(x, y);
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
let startPos = [
|
let startPos = [
|
||||||
Math.max(0.0, Math.min(1.0, localX / this._actor.width)),
|
Math.max(0.0, Math.min(1.0, localX / shader._actor.width)),
|
||||||
Math.max(0.0, Math.min(1.0, localY / this._actor.height))
|
Math.max(0.0, Math.min(1.0, localY / shader._actor.height))
|
||||||
];
|
];
|
||||||
shader.set_uniform_float(shader._uStartPos, 2, startPos);
|
shader.set_uniform_float(shader._uStartPos, 2, startPos);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,25 +48,24 @@ export default class Effect {
|
|||||||
'begin-animation', (shader, settings, forOpening, testMode, actor) => {
|
'begin-animation', (shader, settings, forOpening, testMode, actor) => {
|
||||||
// Because the actor position may change after the begin-animation signal is
|
// Because the actor position may change after the begin-animation signal is
|
||||||
// called, we set the uStartPos uniform during the update callback.
|
// called, we set the uStartPos uniform during the update callback.
|
||||||
this._startPointerPos = global.get_pointer();
|
shader._startPointerPos = global.get_pointer();
|
||||||
this._actor = actor;
|
shader._actor = actor;
|
||||||
|
|
||||||
// clang-format off
|
shader.set_uniform_float(shader._uPixelSize, 1,
|
||||||
shader.set_uniform_float(shader._uPixelSize, 1, [settings.get_int('pixel-wipe-pixel-size')]);
|
[settings.get_int('pixel-wipe-pixel-size')]);
|
||||||
// clang-format on
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// We set the uStartPos uniform during the update callback as the actor position
|
// We set the uStartPos uniform during the update callback as the actor position
|
||||||
// may not be set up properly before the begin animation callback.
|
// may not be set up properly before the begin animation callback.
|
||||||
shader.connect('update-animation', (shader) => {
|
shader.connect('update-animation', (shader) => {
|
||||||
if (this._startPointerPos) {
|
if (shader._startPointerPos) {
|
||||||
const [x, y] = this._startPointerPos;
|
const [x, y] = shader._startPointerPos;
|
||||||
const [ok, localX, localY] = this._actor.transform_stage_point(x, y);
|
const [ok, localX, localY] = shader._actor.transform_stage_point(x, y);
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
let startPos = [
|
let startPos = [
|
||||||
Math.max(0.0, Math.min(1.0, localX / this._actor.width)),
|
Math.max(0.0, Math.min(1.0, localX / shader._actor.width)),
|
||||||
Math.max(0.0, Math.min(1.0, localY / this._actor.height))
|
Math.max(0.0, Math.min(1.0, localY / shader._actor.height))
|
||||||
];
|
];
|
||||||
shader.set_uniform_float(shader._uStartPos, 2, startPos);
|
shader.set_uniform_float(shader._uStartPos, 2, startPos);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user