Interface CanvasMouseListener


public interface CanvasMouseListener
Use ScreenSpaceCanvas.addMouseListener(CanvasMouseListener) to add a mouse listener to a canvas.
If you have a web-development background, you might expect that events propagate (bubble-up), and notify event listeners of every component at a certain point. In such case, note that mouse events in Bookmap do not propagate - only one module gets to handle an event, which is the module that provided the highest score from getEventScore(CanvasMouseEvent).

Internally a mouse event lifecycle looks like this:

  1. A mouse event occurs
  2. getEventScore(CanvasMouseEvent) is called for every module
  3. Bookmap finds a module with the highest score
  4. If this module is different from the previously focused one, onFocusLost() is called on the previous one
  5. Bookmap calls onFocusGained() on the newly focused module
  6. Bookmap calls the corresponding method (e.g. mouseClicked(CanvasMouseEvent)) only on the focused module