js: Use Clutter transitions for adjustment changes
This concludes our quest of moving from Tweener to Clutter's animation framework. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/669
This commit is contained in:
parent
8ac2086ed1
commit
b67c300484
@ -31,7 +31,6 @@ const LoginManager = imports.misc.loginManager;
|
|||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
const Realmd = imports.gdm.realmd;
|
const Realmd = imports.gdm.realmd;
|
||||||
const Tweener = imports.ui.tweener;
|
|
||||||
const UserWidget = imports.ui.userWidget;
|
const UserWidget = imports.ui.userWidget;
|
||||||
|
|
||||||
const _FADE_ANIMATION_TIME = 250;
|
const _FADE_ANIMATION_TIME = 250;
|
||||||
@ -205,11 +204,10 @@ var UserList = class {
|
|||||||
let adjustment = this.actor.get_vscroll_bar().get_adjustment();
|
let adjustment = this.actor.get_vscroll_bar().get_adjustment();
|
||||||
|
|
||||||
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
|
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
|
||||||
Tweener.removeTweens(adjustment);
|
adjustment.ease(value, {
|
||||||
Tweener.addTween (adjustment,
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
{ value: value,
|
duration: _SCROLL_ANIMATION_TIME
|
||||||
time: _SCROLL_ANIMATION_TIME / 1000,
|
});
|
||||||
transition: 'easeOutQuad' });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jumpToItem(item) {
|
jumpToItem(item) {
|
||||||
|
@ -9,7 +9,6 @@ const Mainloop = imports.mainloop;
|
|||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const Tweener = imports.ui.tweener;
|
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
|
|
||||||
var SCROLL_TIME = 100;
|
var SCROLL_TIME = 100;
|
||||||
@ -426,10 +425,10 @@ function ensureActorVisibleInScrollView(scrollView, actor) {
|
|||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Tweener.addTween(adjustment,
|
adjustment.ease(value, {
|
||||||
{ value: value,
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
time: SCROLL_TIME / 1000,
|
duration: SCROLL_TIME
|
||||||
transition: 'easeOutQuad' });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var AppSettingsMonitor = class {
|
var AppSettingsMonitor = class {
|
||||||
|
@ -13,7 +13,6 @@ const IconGrid = imports.ui.iconGrid;
|
|||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const PageIndicators = imports.ui.pageIndicators;
|
const PageIndicators = imports.ui.pageIndicators;
|
||||||
const PopupMenu = imports.ui.popupMenu;
|
const PopupMenu = imports.ui.popupMenu;
|
||||||
const Tweener = imports.ui.tweener;
|
|
||||||
const Search = imports.ui.search;
|
const Search = imports.ui.search;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
const Util = imports.misc.util;
|
const Util = imports.misc.util;
|
||||||
@ -498,10 +497,11 @@ var AllView = class AllView extends BaseAppView {
|
|||||||
time = Math.min(time, PAGE_SWITCH_TIME);
|
time = Math.min(time, PAGE_SWITCH_TIME);
|
||||||
|
|
||||||
this._grid.currentPage = pageNumber;
|
this._grid.currentPage = pageNumber;
|
||||||
Tweener.addTween(this._adjustment,
|
this._adjustment.ease(this._grid.getPageY(pageNumber), {
|
||||||
{ value: this._grid.getPageY(this._grid.currentPage),
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
time: time / 1000,
|
duration: time
|
||||||
transition: 'easeOutQuad' });
|
});
|
||||||
|
|
||||||
this._pageIndicators.setCurrentPage(pageNumber);
|
this._pageIndicators.setCurrentPage(pageNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,10 +458,9 @@ var SwitcherList = GObject.registerClass({
|
|||||||
value = Math.max(upper, item.allocation.x2 - pageSize);
|
value = Math.max(upper, item.allocation.x2 - pageSize);
|
||||||
|
|
||||||
this._scrollableRight = true;
|
this._scrollableRight = true;
|
||||||
Tweener.addTween(adjustment,
|
adjustment.ease(value, {
|
||||||
{ value: value,
|
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
time: POPUP_SCROLL_TIME / 1000,
|
duration: POPUP_SCROLL_TIME,
|
||||||
transition: 'easeOutQuad',
|
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
if (this._highlighted == 0)
|
if (this._highlighted == 0)
|
||||||
this._scrollableLeft = false;
|
this._scrollableLeft = false;
|
||||||
@ -482,10 +481,9 @@ var SwitcherList = GObject.registerClass({
|
|||||||
value = Math.min(upper, item.allocation.x2 - pageSize);
|
value = Math.min(upper, item.allocation.x2 - pageSize);
|
||||||
|
|
||||||
this._scrollableLeft = true;
|
this._scrollableLeft = true;
|
||||||
Tweener.addTween(adjustment,
|
adjustment.ease(value, {
|
||||||
{ value: value,
|
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
time: POPUP_SCROLL_TIME / 1000,
|
duration: POPUP_SCROLL_TIME,
|
||||||
transition: 'easeOutQuad',
|
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
if (this._highlighted == this._items.length - 1)
|
if (this._highlighted == this._items.length - 1)
|
||||||
this._scrollableRight = false;
|
this._scrollableRight = false;
|
||||||
|
@ -5,7 +5,6 @@ const { Clutter, Gio, GObject, Meta, Shell, St } = imports.gi;
|
|||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const Tweener = imports.ui.tweener;
|
|
||||||
const WindowManager = imports.ui.windowManager;
|
const WindowManager = imports.ui.windowManager;
|
||||||
const Workspace = imports.ui.workspace;
|
const Workspace = imports.ui.workspace;
|
||||||
|
|
||||||
@ -245,13 +244,10 @@ var WorkspacesView = class extends WorkspacesViewBase {
|
|||||||
|
|
||||||
this._animatingScroll = true;
|
this._animatingScroll = true;
|
||||||
|
|
||||||
Tweener.addTween(this.scrollAdjustment, {
|
this.scrollAdjustment.ease(index, {
|
||||||
value: index,
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
time: WORKSPACE_SWITCH_TIME / 1000,
|
duration: WORKSPACE_SWITCH_TIME,
|
||||||
transition: 'easeOutQuad',
|
onComplete: () => this._animatingScroll = false
|
||||||
onComplete: () => {
|
|
||||||
this._animatingScroll = false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user