fix clay
This commit is contained in:
@@ -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') {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user