A
A
assdfgxcv2020-08-21 09:18:14
JavaScript
assdfgxcv, 2020-08-21 09:18:14

Hover event on diamond in canvas?

There is a rhombus on the canvas for which you need to work out the hover event. How to do it? couldn't google anything.
now I'm looking for the hover area through the condition with the coordinates of the mouse and the rhombus itself:

if (x >= box_x && x < box_x + box.width && y >= box_y && y < box_y +  box.height)

but the problem is that the hover area with such a condition is in the form of a square.
tell me how to make a hover on a rhombus?
there may be articles on this topic somewhere, but I did not find

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twobomb, 2020-08-21
@assdfgxcv

About Kolizhin

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question