Improve how we determine whether we're at display-start or display-end
This commit is contained in:
parent
b1d3815bec
commit
f69d935774
|
|
@ -324,8 +324,11 @@ export const XREffect = GObject.registerClass({
|
|||
constructor(params = {}) {
|
||||
super(params);
|
||||
|
||||
this._is_display_distance_at_end = false;
|
||||
this._distance_ease_timeline = null;
|
||||
this.connect('notify::toggle-display-distance-start', this._handle_display_distance_properties_change.bind(this));
|
||||
this.connect('notify::toggle-display-distance-end', this._handle_display_distance_properties_change.bind(this));
|
||||
this.connect('notify::display-distance', this._handle_display_distance_properties_change.bind(this));
|
||||
this._handle_display_distance_properties_change();
|
||||
|
||||
const calibrating = GdkPixbuf.Pixbuf.new_from_file(`${Globals.extension_dir}/textures/calibrating.png`);
|
||||
this.calibratingImage = new Clutter.Image();
|
||||
|
|
@ -338,6 +341,12 @@ export const XREffect = GObject.registerClass({
|
|||
customBanner.width, customBanner.height, customBanner.rowstride);
|
||||
}
|
||||
|
||||
_handle_display_distance_properties_change() {
|
||||
const distance_from_end = Math.abs(this.display_distance - this.toggle_display_distance_end);
|
||||
const distance_from_start = Math.abs(this.display_distance - this.toggle_display_distance_start);
|
||||
this._is_display_distance_at_end = distance_from_end < distance_from_start;
|
||||
}
|
||||
|
||||
_change_distance() {
|
||||
if (this._distance_ease_timeline?.is_playing()) this._distance_ease_timeline.stop();
|
||||
|
||||
|
|
@ -351,7 +360,6 @@ export const XREffect = GObject.registerClass({
|
|||
this._distance_ease_timeline.get_progress() *
|
||||
(toggle_display_distance_target - this._distance_ease_start);
|
||||
});
|
||||
this._is_display_distance_at_end = !this._is_display_distance_at_end;
|
||||
|
||||
this._distance_ease_timeline.start();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue