forked from AbleOS/ableos
fix cursor going out of bounds
This commit is contained in:
parent
c6da72f393
commit
ffee890842
|
@ -63,8 +63,8 @@ main := fn(): int {
|
|||
loop {
|
||||
mouse_event := intouch.recieve_mouse_event()
|
||||
if mouse_event != null {
|
||||
mouse.x = clamp(int, mouse.x + mouse_event.x_change, mouse.cursor_width, @bitcast(screen.width - mouse.cursor_width))
|
||||
mouse.y = clamp(int, mouse.y - mouse_event.y_change, mouse.cursor_width, @bitcast(screen.height - mouse.cursor_width))
|
||||
mouse.x = clamp(int, mouse.x + mouse_event.x_change, mouse.cursor_width + 1, @bitcast(screen.width - mouse.cursor_width - 1))
|
||||
mouse.y = clamp(int, mouse.y - mouse_event.y_change, mouse.cursor_width + 1, @bitcast(screen.height - mouse.cursor_width - 1))
|
||||
|
||||
if mouse_event.left {
|
||||
text_label.set_label_text("LEFT CLICK")
|
||||
|
|
Loading…
Reference in a new issue