Libraryless. Click here for Pure Java version (16903L/106K).
// onHover is called with null value when mouse moves outside of image surface // onHover receives image coordinates svoid imageSurfaceOnHover(ImageSurface is, VF1<Pt> onHover) { if (is == null || onHover == null) ret; swing { MouseAdapter ma = new MouseAdapter { public void mouseMoved(MouseEvent e) { pick(e); } public void mouseEntered(MouseEvent e) { pick(e); } public void mouseExited(MouseEvent e) { pick(null); } void pick(MouseEvent e) pcall { callF(onHover, e == null ? (Pt) null : is.pointFromEvent(e)); } }; is.addMouseMotionListener(ma); is.addMouseListener(ma); } } svoid imageSurfaceOnHover(ImageSurface is, IVF1<Pt> onHover) { imageSurfaceOnHover(is, toVF1(onHover)); }
Began life as a copy of #1024564
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024565 |
Snippet name: | imageSurfaceOnHover |
Eternal ID of this version: | #1024565/4 |
Text MD5: | 68369fbd8f6bcf3bc42d63e677da116d |
Transpilation MD5: | 9a3f38911f944e2daa6133404f604aa9 |
Author: | stefan |
Category: | javax / image analysis |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-14 20:18:31 |
Source code size: | 775 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 272 / 361 |
Version history: | 3 change(s) |
Referenced in: | [show references] |