environment: Allow marking animations as required
There are cases when we want to mark an animation as required. For example, we want the "Locate Pointer" animation to work even when the animation as marked as disabled. Take this into account when easing an actor. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2986>
This commit is contained in:
parent
27878aa096
commit
8c7965f048
@ -93,17 +93,21 @@ function _easeActor(actor, params) {
|
|||||||
params = {
|
params = {
|
||||||
repeatCount: 0,
|
repeatCount: 0,
|
||||||
autoReverse: false,
|
autoReverse: false,
|
||||||
|
animationRequired: false,
|
||||||
...params,
|
...params,
|
||||||
};
|
};
|
||||||
|
|
||||||
actor.save_easing_state();
|
actor.save_easing_state();
|
||||||
|
|
||||||
|
const animationRequired = params.animationRequired;
|
||||||
|
delete params.animationRequired;
|
||||||
|
|
||||||
if (params.duration !== undefined)
|
if (params.duration !== undefined)
|
||||||
actor.set_easing_duration(params.duration);
|
actor.set_easing_duration(params.duration, {animationRequired});
|
||||||
delete params.duration;
|
delete params.duration;
|
||||||
|
|
||||||
if (params.delay !== undefined)
|
if (params.delay !== undefined)
|
||||||
actor.set_easing_delay(params.delay);
|
actor.set_easing_delay(params.delay, {animationRequired});
|
||||||
delete params.delay;
|
delete params.delay;
|
||||||
|
|
||||||
const repeatCount = params.repeatCount;
|
const repeatCount = params.repeatCount;
|
||||||
@ -162,6 +166,7 @@ function _easeActorProperty(actor, propName, target, params) {
|
|||||||
params = {
|
params = {
|
||||||
repeatCount: 0,
|
repeatCount: 0,
|
||||||
autoReverse: false,
|
autoReverse: false,
|
||||||
|
animationRequired: false,
|
||||||
...params,
|
...params,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -170,12 +175,15 @@ function _easeActorProperty(actor, propName, target, params) {
|
|||||||
params.progress_mode = params.mode;
|
params.progress_mode = params.mode;
|
||||||
delete params.mode;
|
delete params.mode;
|
||||||
|
|
||||||
|
const animationRequired = params.animationRequired;
|
||||||
|
delete params.animationRequired;
|
||||||
|
|
||||||
if (params.duration)
|
if (params.duration)
|
||||||
params.duration = adjustAnimationTime(params.duration);
|
params.duration = adjustAnimationTime(params.duration, {animationRequired});
|
||||||
let duration = Math.floor(params.duration || 0);
|
let duration = Math.floor(params.duration || 0);
|
||||||
|
|
||||||
if (params.delay)
|
if (params.delay)
|
||||||
params.delay = adjustAnimationTime(params.delay);
|
params.delay = adjustAnimationTime(params.delay, {animationRequired});
|
||||||
|
|
||||||
const repeatCount = params.repeatCount;
|
const repeatCount = params.repeatCount;
|
||||||
delete params.repeatCount;
|
delete params.repeatCount;
|
||||||
@ -282,12 +290,12 @@ _patchLayoutClass(Clutter.GridLayout, {
|
|||||||
_patchLayoutClass(Clutter.BoxLayout, {spacing: 'spacing'});
|
_patchLayoutClass(Clutter.BoxLayout, {spacing: 'spacing'});
|
||||||
|
|
||||||
const origSetEasingDuration = Clutter.Actor.prototype.set_easing_duration;
|
const origSetEasingDuration = Clutter.Actor.prototype.set_easing_duration;
|
||||||
Clutter.Actor.prototype.set_easing_duration = function (msecs) {
|
Clutter.Actor.prototype.set_easing_duration = function (msecs, params = {}) {
|
||||||
origSetEasingDuration.call(this, adjustAnimationTime(msecs));
|
origSetEasingDuration.call(this, adjustAnimationTime(msecs, params));
|
||||||
};
|
};
|
||||||
const origSetEasingDelay = Clutter.Actor.prototype.set_easing_delay;
|
const origSetEasingDelay = Clutter.Actor.prototype.set_easing_delay;
|
||||||
Clutter.Actor.prototype.set_easing_delay = function (msecs) {
|
Clutter.Actor.prototype.set_easing_delay = function (msecs, params = {}) {
|
||||||
origSetEasingDelay.call(this, adjustAnimationTime(msecs));
|
origSetEasingDelay.call(this, adjustAnimationTime(msecs, params));
|
||||||
};
|
};
|
||||||
|
|
||||||
Clutter.Actor.prototype.ease = function (props) {
|
Clutter.Actor.prototype.ease = function (props) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user