fix(ags cursorbox): make release more reliable
Some checks are pending
Discord / discord commits (push) Waiting to run
Some checks are pending
Discord / discord commits (push) Waiting to run
This commit is contained in:
parent
5eeb29677d
commit
4f4b1e5140
1 changed files with 7 additions and 9 deletions
|
@ -59,22 +59,20 @@ export class CursorBox<Child extends Gtk.Widget, Attr> extends Gtk.EventBox {
|
||||||
this.add_events(Gdk.EventMask.SMOOTH_SCROLL_MASK);
|
this.add_events(Gdk.EventMask.SMOOTH_SCROLL_MASK);
|
||||||
|
|
||||||
// Gesture stuff
|
// Gesture stuff
|
||||||
const gesture = Gtk.GestureLongPress.new(this);
|
const gesture = Gtk.GestureMultiPress.new(this);
|
||||||
|
|
||||||
this.hook(gesture, () => {
|
this.hook(gesture, (_, _n, x, y) => {
|
||||||
const pointer = gesture.get_point(null);
|
if (!x || !y) {
|
||||||
const x = pointer[1];
|
|
||||||
const y = pointer[2];
|
|
||||||
|
|
||||||
if ((!x || !y) || (x === 0 && y === 0)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#canRun.setValue(!(
|
this.#canRun.setValue(!(
|
||||||
x > this.get_allocated_width() ||
|
x > this.get_allocated_width() ||
|
||||||
y > this.get_allocated_height()
|
x <= 0 ||
|
||||||
|
y > this.get_allocated_height() ||
|
||||||
|
y <= 0
|
||||||
));
|
));
|
||||||
}, 'end');
|
}, 'released');
|
||||||
|
|
||||||
this.connect('enter-notify-event', (_, event: Gdk.Event) => {
|
this.connect('enter-notify-event', (_, event: Gdk.Event) => {
|
||||||
this.set_state_flags(Gtk.StateFlags.PRELIGHT, false);
|
this.set_state_flags(Gtk.StateFlags.PRELIGHT, false);
|
||||||
|
|
Loading…
Reference in a new issue