[gnome-shell/wip/exalm/gestures: 10/20] 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: 10/20] workspaceThumbnail: Use translation to animate indicator
- Date: Fri, 5 Jul 2019 12:00:11 +0000 (UTC)
commit 0e9eff2f3428373151784e329240ab0632575934
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.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/605
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 eaf2f6947..8e514edfd 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -1000,7 +1000,7 @@ class ThumbnailsBox extends St.Widget {
set indicatorY(indicatorY) {
this._indicatorY = indicatorY;
- this.queue_relayout();
+ this._indicator.translation_y = indicatorY;
}
get indicatorY() {
@@ -1206,11 +1206,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);
@@ -1264,7 +1263,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;
}
@@ -1295,7 +1294,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);
}
@@ -1310,12 +1309,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]