D
D
Dmitry Lokshin2017-04-18 16:33:49
JavaScript
Dmitry Lokshin, 2017-04-18 16:33:49

How to delegate the mouse down event?

Hello dear developers.
I implemented this thing https://jsfiddle.net/lokdmt/cjj6b5x7/8/ , where you can erase dirt from a T-shirt and after a certain percentage of erased stains a popup appears (now it's just an alert), but that's not the point.
The task is as follows: the client grabs a sponge with the mouse and erases the stains.
At the moment, the spots are erased separately with the mouse cursor, and you can grab the sponge separately. But with a captured sponge, the stains are not erased.
I suspect that it is possible to delegate the event of the pressed mouse to the sponge, but it does not work.
I would be very grateful for help or advice on how to implement this better.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IsaevDev, 2017-04-18
@IsaevDev

Why delegate?
Is there a delta of mouse movements? When grabbing the sponge, you begin to transfer the movement to the sponge and
the PS mask, the comma should be removed from the reference)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question