environment: Handle reversed transition with 0 duration
If a transition is reversed, the final property values will be the same as before the transition. However this currently only works correctly when we actually use a transition; to fix this with a duration of 0, simply skip the set() call when the transition is reversed. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1042
This commit is contained in:
parent
967a6ae44d
commit
2bb8e1be9b
@ -111,6 +111,11 @@ function _easeActor(actor, params) {
|
||||
autoReverse = params.autoReverse;
|
||||
delete params.autoReverse;
|
||||
|
||||
// repeatCount doesn't include the initial iteration
|
||||
const numIterations = repeatCount + 1;
|
||||
// whether the transition should finish where it started
|
||||
const isReversed = autoReverse && numIterations % 2 === 0;
|
||||
|
||||
if (params.mode != undefined)
|
||||
actor.set_easing_mode(params.mode);
|
||||
delete params.mode;
|
||||
@ -122,6 +127,7 @@ function _easeActor(actor, params) {
|
||||
let animatedProps = Object.keys(params).map(p => p.replace('_', '-', 'g'));
|
||||
animatedProps.forEach(p => actor.remove_transition(p));
|
||||
|
||||
if (actor.get_easing_duration() > 0 || !isReversed)
|
||||
actor.set(params);
|
||||
actor.restore_easing_state();
|
||||
|
||||
@ -161,6 +167,11 @@ function _easeActorProperty(actor, propName, target, params) {
|
||||
autoReverse = params.autoReverse;
|
||||
delete params.autoReverse;
|
||||
|
||||
// repeatCount doesn't include the initial iteration
|
||||
const numIterations = repeatCount + 1;
|
||||
// whether the transition should finish where it started
|
||||
const isReversed = autoReverse && numIterations % 2 === 0;
|
||||
|
||||
// Copy Clutter's behavior for implicit animations, see
|
||||
// should_skip_implicit_transition()
|
||||
if (actor instanceof Clutter.Actor && !actor.mapped)
|
||||
@ -174,6 +185,8 @@ function _easeActorProperty(actor, propName, target, params) {
|
||||
|
||||
if (duration == 0) {
|
||||
let [obj, prop] = _getPropertyTarget(actor, propName);
|
||||
|
||||
if (!isReversed)
|
||||
obj[prop] = target;
|
||||
|
||||
Meta.disable_unredirect_for_display(global.display);
|
||||
|
Loading…
Reference in New Issue
Block a user