Skip to content

Commit

Permalink
Add close tint & prevent pivot revert on progress
Browse files Browse the repository at this point in the history
  • Loading branch information
amarullz committed Oct 12, 2023
1 parent 885aef1 commit 47228df
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ class Manager {
ui = activeWin.get_compositor_private();
this._actionWidgets.minimize = ui;
if (ui) {
ui.set_pivot_point(0.5, 1);
ui.set_pivot_point(0.5, 0.8);
}
}
else {
Expand All @@ -1308,6 +1308,7 @@ class Manager {
// Execute Progress
if (ui && ui != -1) {
if (!state) {
ui.set_pivot_point(0.5, 0.8);
ui.opacity = 255 - Math.round(127 * progress);
ui.scale_x = 1.0 - (0.5 * progress);
ui.scale_y = 1.0 - (0.5 * progress);
Expand Down Expand Up @@ -1375,6 +1376,12 @@ class Manager {
this._actionWidgets.close = ui;
if (ui) {
ui.set_pivot_point(0.5, 0.5);

let wrect = activeWin.get_frame_rect();
ui._layer = this._createUi(
'wgs-indicator-close',
wrect.x, wrect.y, wrect.width, wrect.height
);
}
}
else {
Expand All @@ -1385,9 +1392,11 @@ class Manager {
// Execute Progress
if (ui && ui != -1) {
if (!state) {
ui.set_pivot_point(0.5, 0.5);
ui.opacity = 255 - Math.round(160 * progress);
ui.scale_x = 1.0 - (progress * 0.25);
ui.scale_y = 1.0 - (progress * 0.25);
ui._layer.scale_x = ui.scale_x = 1.0 - (progress * 0.25);
ui._layer.scale_y = ui.scale_y = 1.0 - (progress * 0.25);
ui._layer.opacity = Math.round(255 * progress);
}
else {
activeWin = null;
Expand All @@ -1398,6 +1407,9 @@ class Manager {
}

let me = this;

ui._layer.release();
ui._layer = null;
ui.ease({
duration: Math.round(250 * progress),
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
Expand Down Expand Up @@ -1459,6 +1471,7 @@ class Manager {
if (ui && ui != -1) {
if (!state) {
ui.forEach((aui) => {
aui.set_pivot_point(0.5, 0.5);
aui.opacity = 255 - Math.round(100 * progress);
aui.scale_x = 1.0 - (progress * 0.4);
aui.scale_y = 1.0 - (progress * 0.4);
Expand Down

1 comment on commit 47228df

@amarullz
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrade & resolve issue #4 and #7

Please sign in to comment.