[gnome-shell] js: Use Clutter transitions for adjustment changes
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] js: Use Clutter transitions for adjustment changes
- Date: Wed, 7 Aug 2019 16:52:25 +0000 (UTC)
commit b67c300484fbcf4df40adfa65d244f0e6dc24a52
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Jul 24 21:03:17 2019 +0200
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
js/gdm/loginDialog.js | 10 ++++------
js/misc/util.js | 9 ++++-----
js/ui/appDisplay.js | 10 +++++-----
js/ui/switcherPopup.js | 38 ++++++++++++++++++--------------------
js/ui/workspacesView.js | 12 ++++--------
5 files changed, 35 insertions(+), 44 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 13db8c6ec..76edcf44f 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -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) {
diff --git a/js/misc/util.js b/js/misc/util.js
index 7f46e4506..b101e5559 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -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 {
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 9947fdcae..b2cdb3d9d 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -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);
}
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index 5167bb568..c311026c3 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -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) {
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 5acc3e438..af490e94a 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -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
});
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]