Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1019911 // imageSurfaceOnMouseMoveOrDrag

JavaX fragment (include)

// f : voidfunc(Pt) - point can be null, then mouse has exited
static void imageSurfaceOnMouseMoveOrDrag(final ImageSurface is, final O f) {
  swing {
    MouseAdapter ma = new MouseAdapter {
      public void mouseMoved(MouseEvent e) {
        pcallF(f, is.pointFromEvent(e));
      }
      
      public void mouseDragged(MouseEvent e) {
        pcallF(f, is.pointFromEvent(e));
      }
      
      public void mouseEntered(MouseEvent e) {
        pcallF(f, is.pointFromEvent(e));
      }
  
      public void mouseExited(MouseEvent e) {
        pcallF(f, (Pt) null);
      }
    };
    is.addMouseMotionListener(ma);
    is.addMouseListener(ma);
  }
}

Author comment

Began life as a copy of #1005948

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019911
Snippet name: imageSurfaceOnMouseMoveOrDrag
Eternal ID of this version: #1019911/1
Text MD5: 1cbf17387ccf590b54e2976f82ee1420
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-30 21:49:19
Source code size: 678 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 291 / 324
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1019913 - imageSurfaceOnMouseMoveOrDrag_double - higher precision