Utilizing the handleMouseUp function

This function is called when a user releases the mouse click and uses it to end the drawing lines and remove the event from stage. Its source code is as follows:

function handleMouseUp(event) {
  stage.removeEventListener("stagemousemove", handleMouseMove);
}

All we do in this function is call removeEventListener to remove the mousemove event and prevent calling the function anymore. After removing this event from stage, the handleMouseMove function won't call anymore. So, by moving the mouse cursor, EaselJS won't call our function until the next mousedown event. That's exactly what we want to handle in the painting logic.

In the following screenshot, you can see a preview of this application:

Utilizing the handleMouseUp function
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.162.51