MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / mousePressed

Method mousePressed

ij/src/main/java/ij/gui/ImageCanvas.java:1158–1316  ·  view source on GitHub ↗
(final MouseEvent e)

Source from the content-addressed store, hash-verified

1156 }
1157
1158 public void mousePressed(final MouseEvent e) {
1159 showCursorStatus = true;
1160 int toolID = Toolbar.getToolId();
1161 ImageWindow win = imp.getWindow();
1162 if (win!=null && win.running2 && toolID!=Toolbar.MAGNIFIER) {
1163 if (win instanceof StackWindow)
1164 ((StackWindow)win).setAnimate(false);
1165 else
1166 win.running2 = false;
1167 return;
1168 }
1169
1170 int x = e.getX();
1171 int y = e.getY();
1172 flags = e.getModifiers();
1173 if (toolID!=Toolbar.MAGNIFIER && (e.isPopupTrigger()||(!IJ.isMacintosh()&&(flags&Event.META_MASK)!=0))) {
1174 handlePopupMenu(e);
1175 return;
1176 }
1177
1178 int ox = offScreenX(x);
1179 int oy = offScreenY(y);
1180 xMouse = ox; yMouse = oy;
1181 if (IJ.spaceBarDown()) {
1182 // temporarily switch to "hand" tool of space bar down
1183 setupScroll(ox, oy);
1184 return;
1185 }
1186
1187 if (overOverlayLabel && (imp.getOverlay()!=null||showAllOverlay!=null)) {
1188 if (activateOverlayRoi(ox, oy))
1189 return;
1190 }
1191
1192 if ((System.currentTimeMillis()-mousePressedTime)<300L && !drawingTool()) {
1193 if (activateOverlayRoi(ox,oy))
1194 return;
1195 }
1196
1197 mousePressedX = ox;
1198 mousePressedY = oy;
1199 mousePressedTime = System.currentTimeMillis();
1200
1201 PlugInTool tool = Toolbar.getPlugInTool();
1202 if (tool!=null) {
1203 tool.mousePressed(imp, e);
1204 if (e.isConsumed()) return;
1205 }
1206 if (customRoi && imp.getOverlay()!=null)
1207 return;
1208
1209 if (toolID>=Toolbar.CUSTOM1) {
1210 if (tool!=null && "Arrow Tool".equals(tool.getToolName()))
1211 handleRoiMouseDown(e);
1212 else
1213 Toolbar.getInstance().runMacroTool(toolID);
1214 return;
1215 }

Callers 1

mousePressedMethod · 0.95

Calls 15

getToolIdMethod · 0.95
isMacintoshMethod · 0.95
handlePopupMenuMethod · 0.95
offScreenXMethod · 0.95
offScreenYMethod · 0.95
spaceBarDownMethod · 0.95
setupScrollMethod · 0.95
activateOverlayRoiMethod · 0.95
drawingToolMethod · 0.95
getPlugInToolMethod · 0.95
mousePressedMethod · 0.95
getToolNameMethod · 0.95

Tested by

no test coverage detected