[gnome-shell/wip/exalm/gestures: 13/17] workspaceThumbnail: Use translation to animate indicator
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/exalm/gestures: 13/17] workspaceThumbnail: Use translation to animate indicator
- Date: Sun, 30 Jun 2019 13:56:16 +0000 (UTC)
commit 1128b5cd748bf744158c736e0c526869851979f7
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Fri Jun 28 01:51:10 2019 +0500
workspaceThumbnail: Use translation to animate indicator
Avoid relayouts on each frame. This will significantly speed up the
position-based animation added in subsequent commits.
js/ui/workspaceThumbnail.js | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 969167178..25629b814 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -1002,7 +1002,7 @@ class ThumbnailsBox extends St.Widget {
set indicatorY(indicatorY) {
this._indicatorY = indicatorY;
- this.queue_relayout();
+ this._indicator.translation_y = indicatorY;
}
get indicatorY() {
@@ -1208,11 +1208,10 @@ class ThumbnailsBox extends St.Widget {
else
slideOffset = thumbnailWidth + themeNode.get_padding(St.Side.RIGHT);
- let indicatorY1 = this._indicatorY;
+ let indicatorY1;
let indicatorY2;
// when not animating, the workspace position overrides this._indicatorY
let activeWorkspace = workspaceManager.get_active_workspace();
- let indicatorWorkspace = !this._animatingIndicator ? activeWorkspace : null;
let indicatorThemeNode = this._indicator.get_theme_node();
let indicatorTopFullBorder = indicatorThemeNode.get_padding(St.Side.TOP) +
indicatorThemeNode.get_border_width(St.Side.TOP);
@@ -1266,7 +1265,7 @@ class ThumbnailsBox extends St.Widget {
let y2 = Math.round(y + thumbnailHeight);
let roundedVScale = (y2 - y1) / portholeHeight;
- if (thumbnail.metaWorkspace == indicatorWorkspace) {
+ if (thumbnail.metaWorkspace == activeWorkspace) {
indicatorY1 = y1;
indicatorY2 = y2;
}
@@ -1297,7 +1296,7 @@ class ThumbnailsBox extends St.Widget {
childBox.x1 -= indicatorLeftFullBorder;
childBox.x2 += indicatorRightFullBorder;
childBox.y1 = indicatorY1 - indicatorTopFullBorder;
- childBox.y2 = (indicatorY2 ? indicatorY2 : (indicatorY1 + thumbnailHeight)) +
indicatorBottomFullBorder;
+ childBox.y2 = indicatorY2 + indicatorBottomFullBorder;
this._indicator.allocate(childBox, flags);
}
@@ -1312,12 +1311,13 @@ class ThumbnailsBox extends St.Widget {
}
}
+ this.queue_relayout();
+
this._animatingIndicator = true;
- let indicatorThemeNode = this._indicator.get_theme_node();
- let indicatorTopFullBorder = indicatorThemeNode.get_padding(St.Side.TOP) +
indicatorThemeNode.get_border_width(St.Side.TOP);
- this.indicatorY = this._indicator.allocation.y1 + indicatorTopFullBorder;
+ this.indicatorY = this._indicator.allocation.y1 - thumbnail.actor.allocation.y1;
+
Tweener.addTween(this,
- { indicatorY: thumbnail.actor.allocation.y1,
+ { indicatorY: 0,
time: WorkspacesView.WORKSPACE_SWITCH_TIME,
transition: 'easeOutQuad',
onComplete() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]