Libraryless. Click here for Pure Java version (26706L/168K).
1 | asclass ImageSurfaceMouseHandler > MouseAdapter is AutoCloseable { |
2 | ImageSurface is; |
3 | |
4 | void register(ImageSurface is) { |
5 | this.is = is; |
6 | is.tools.add(this); |
7 | is.addMouseListener(this); |
8 | is.addMouseMotionListener(this); |
9 | } |
10 | |
11 | close { |
12 | if (is == null) ret; |
13 | is.tools.remove(this); |
14 | is.removeMouseListener(this); |
15 | is.removeMouseMotionListener(this); |
16 | is = null; |
17 | } |
18 | |
19 | Pt getPt(MouseEvent e) { |
20 | ret toPt(getPoint(e)); |
21 | } |
22 | |
23 | Point getPoint(MouseEvent e) { |
24 | ret new Point((int) (e.getX()/is.getZoomX()), (int) (e.getY()/is.getZoomY())); |
25 | } |
26 | |
27 | ImageSurface getImageSurface() { ret is; } |
28 | } |
Began life as a copy of #1033785
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033786 |
Snippet name: | ImageSurfaceMouseHandler |
Eternal ID of this version: | #1033786/6 |
Text MD5: | 2f9942fce5721adbb32642d1a55d8fd2 |
Transpilation MD5: | f42ea2d530f6780d807996e7d889c4e3 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-15 22:18:10 |
Source code size: | 654 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 263 / 401 |
Version history: | 5 change(s) |
Referenced in: | [show references] |