This commit is contained in:
2025-11-01 14:12:58 -05:00
parent 708c01ee29
commit a8eed4e0d8
2 changed files with 3 additions and 7 deletions

View File

@@ -8,7 +8,6 @@ var graphics = use('graphics')
var util = use('util')
var input = use('input')
var prosperon = use('prosperon')
var staef = use('staef')
function normalizeSpacing(spacing) {
if (typeof spacing == 'number') {

View File

@@ -8,12 +8,9 @@ var clay_input = {}
// Hit-test boxes against a mouse position
// boxes: array of box objects from clay.draw()
// mousepos: {x, y} position to test
// pos: {x, y} position to test
// prev_state: previous input state for tracking changes
clay_input.hit = function hit(boxes, mouse, prev_state = {}) {
var mousepos = {...mouse}
mousepos.x *= 640
mousepos.y *= 360
clay_input.hit = function hit(boxes, pos, prev_state = {}) {
var hovered = null
var clicked = null
@@ -21,7 +18,7 @@ clay_input.hit = function hit(boxes, mouse, prev_state = {}) {
for (var i = boxes.length - 1; i >= 0; i--) {
var box = boxes[i]
var boundingbox = geometry.rect_move(box.boundingbox, box.config.offset)
if (geometry.rect_point_inside(boundingbox, mousepos)) {
if (geometry.rect_point_inside(boundingbox, pos)) {
hovered = box
break
}