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 PopupMenu = imports.ui.popupMenu;
|
||||
const Realmd = imports.gdm.realmd;
|
||||
const Tweener = imports.ui.tweener;
|
||||
const UserWidget = imports.ui.userWidget;
|
||||
|
||||
const _FADE_ANIMATION_TIME = 250;
|
||||
@ -205,11 +204,10 @@ var UserList = class {
|
||||
let adjustment = this.actor.get_vscroll_bar().get_adjustment();
|
||||
|
||||
let value = (box.y1 + adjustment.step_increment / 2.0) - (adjustment.page_size / 2.0);
|
||||
Tweener.removeTweens(adjustment);
|
||||
Tweener.addTween (adjustment,
|
||||
{ value: value,
|
||||
time: _SCROLL_ANIMATION_TIME / 1000,
|
||||
transition: 'easeOutQuad' });
|
||||
adjustment.ease(value, {
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: _SCROLL_ANIMATION_TIME
|
||||
});
|
||||
}
|
||||
|
||||
jumpToItem(item) {
|
||||
|
@ -9,7 +9,6 @@ const Mainloop = imports.mainloop;
|
||||
const Signals = imports.signals;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const Tweener = imports.ui.tweener;
|
||||
const Params = imports.misc.params;
|
||||
|
||||
var SCROLL_TIME = 100;
|
||||
@ -426,10 +425,10 @@ function ensureActorVisibleInScrollView(scrollView, actor) {
|
||||
else
|
||||
return;
|
||||
|
||||
Tweener.addTween(adjustment,
|
||||
{ value: value,
|
||||
time: SCROLL_TIME / 1000,
|
||||
transition: 'easeOutQuad' });
|
||||
adjustment.ease(value, {
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: SCROLL_TIME
|
||||
});
|
||||
}
|
||||
|
||||
var AppSettingsMonitor = class {
|
||||
|
@ -13,7 +13,6 @@ const IconGrid = imports.ui.iconGrid;
|
||||
const Main = imports.ui.main;
|
||||
const PageIndicators = imports.ui.pageIndicators;
|
||||
const PopupMenu = imports.ui.popupMenu;
|
||||
const Tweener = imports.ui.tweener;
|
||||
const Search = imports.ui.search;
|
||||
const Params = imports.misc.params;
|
||||
const Util = imports.misc.util;
|
||||
@ -498,10 +497,11 @@ var AllView = class AllView extends BaseAppView {
|
||||
time = Math.min(time, PAGE_SWITCH_TIME);
|
||||
|
||||
this._grid.currentPage = pageNumber;
|
||||
Tweener.addTween(this._adjustment,
|
||||
{ value: this._grid.getPageY(this._grid.currentPage),
|
||||
time: time / 1000,
|
||||
transition: 'easeOutQuad' });
|
||||
this._adjustment.ease(this._grid.getPageY(pageNumber), {
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: time
|
||||
});
|
||||
|
||||
this._pageIndicators.setCurrentPage(pageNumber);
|
||||
}
|
||||
|
||||
|
@ -458,16 +458,15 @@ var SwitcherList = GObject.registerClass({
|
||||
value = Math.max(upper, item.allocation.x2 - pageSize);
|
||||
|
||||
this._scrollableRight = true;
|
||||
Tweener.addTween(adjustment,
|
||||
{ value: value,
|
||||
time: POPUP_SCROLL_TIME / 1000,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: () => {
|
||||
if (this._highlighted == 0)
|
||||
this._scrollableLeft = false;
|
||||
this.queue_relayout();
|
||||
}
|
||||
});
|
||||
adjustment.ease(value, {
|
||||
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: POPUP_SCROLL_TIME,
|
||||
onComplete: () => {
|
||||
if (this._highlighted == 0)
|
||||
this._scrollableLeft = false;
|
||||
this.queue_relayout();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_scrollToRight() {
|
||||
@ -482,16 +481,15 @@ var SwitcherList = GObject.registerClass({
|
||||
value = Math.min(upper, item.allocation.x2 - pageSize);
|
||||
|
||||
this._scrollableLeft = true;
|
||||
Tweener.addTween(adjustment,
|
||||
{ value: value,
|
||||
time: POPUP_SCROLL_TIME / 1000,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: () => {
|
||||
if (this._highlighted == this._items.length - 1)
|
||||
this._scrollableRight = false;
|
||||
this.queue_relayout();
|
||||
}
|
||||
});
|
||||
adjustment.ease(value, {
|
||||
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: POPUP_SCROLL_TIME,
|
||||
onComplete: () => {
|
||||
if (this._highlighted == this._items.length - 1)
|
||||
this._scrollableRight = false;
|
||||
this.queue_relayout();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_itemActivated(n) {
|
||||
|
@ -5,7 +5,6 @@ const { Clutter, Gio, GObject, Meta, Shell, St } = imports.gi;
|
||||
const Signals = imports.signals;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const Tweener = imports.ui.tweener;
|
||||
const WindowManager = imports.ui.windowManager;
|
||||
const Workspace = imports.ui.workspace;
|
||||
|
||||
@ -245,13 +244,10 @@ var WorkspacesView = class extends WorkspacesViewBase {
|
||||
|
||||
this._animatingScroll = true;
|
||||
|
||||
Tweener.addTween(this.scrollAdjustment, {
|
||||
value: index,
|
||||
time: WORKSPACE_SWITCH_TIME / 1000,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: () => {
|
||||
this._animatingScroll = false;
|
||||
}
|
||||
this.scrollAdjustment.ease(index, {
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: WORKSPACE_SWITCH_TIME,
|
||||
onComplete: () => this._animatingScroll = false
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user