boxpointer: Clamp alignments to expected range

The values are expected to be between 0 (start) and 1 (end),
enforce that with appropriate clamp() calls.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3150>
This commit is contained in:
Florian Müllner 2024-01-29 17:29:51 +01:00
parent 4e70315fbb
commit d0b2351036

View File

@ -446,13 +446,13 @@ export const BoxPointer = GObject.registerClass({
() => (this._sourceActor = null), this);
}
this._arrowAlignment = alignment;
this._arrowAlignment = Math.clamp(alignment, 0.0, 1.0);
this.queue_relayout();
}
setSourceAlignment(alignment) {
this._sourceAlignment = alignment;
this._sourceAlignment = Math.clamp(alignment, 0.0, 1.0);
if (!this._sourceActor)
return;