1
0
Fork 0
forked from AbleOS/ableos

fix cursor going out of bounds

This commit is contained in:
koniifer 2025-02-08 11:44:50 +00:00
parent c6da72f393
commit ffee890842

View file

@ -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")