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

Method setCursor

ij/src/main/java/ij/gui/ImageCanvas.java:668–707  ·  view source on GitHub ↗

Sets the cursor based on the current tool and cursor location.

(int sx, int sy, int ox, int oy)

Source from the content-addressed store, hash-verified

666
667 /** Sets the cursor based on the current tool and cursor location. */
668 public void setCursor(int sx, int sy, int ox, int oy) {
669 xMouse = ox;
670 yMouse = oy;
671 mouseExited = false;
672 Roi roi = imp.getRoi();
673 ImageWindow win = imp.getWindow();
674 overOverlayLabel = false;
675 if (win==null)
676 return;
677 if (IJ.spaceBarDown()) {
678 setCursor(handCursor);
679 return;
680 }
681 int id = Toolbar.getToolId();
682 switch (id) {
683 case Toolbar.MAGNIFIER:
684 setCursor(moveCursor);
685 break;
686 case Toolbar.HAND:
687 setCursor(handCursor);
688 break;
689 default: //selection tool
690 PlugInTool tool = Toolbar.getPlugInTool();
691 boolean arrowTool = roi!=null && (roi instanceof Arrow) && tool!=null && "Arrow Tool".equals(tool.getToolName());
692 if ((id>=Toolbar.CUSTOM1) && !arrowTool) {
693 if (Prefs.usePointerCursor)
694 setCursor(defaultCursor);
695 else
696 setCursor(crosshairCursor);
697 } else if (roi!=null && roi.getState()!=roi.CONSTRUCTING && roi.isHandle(sx, sy)>=0) {
698 setCursor(handCursor);
699 } else if ((imp.getOverlay()!=null||showAllOverlay!=null) && overOverlayLabel(sx,sy,ox,oy) && (roi==null||roi.getState()!=roi.CONSTRUCTING)) {
700 overOverlayLabel = true;
701 setCursor(handCursor);
702 } else if (Prefs.usePointerCursor || (roi!=null && roi.getState()!=roi.CONSTRUCTING && roi.contains(ox, oy)))
703 setCursor(defaultCursor);
704 else
705 setCursor(crosshairCursor);
706 }
707 }
708
709 private boolean overOverlayLabel(int sx, int sy, int ox, int oy) {
710 Overlay o = showAllOverlay;

Callers 7

loadCursorsMethod · 0.95
mouseExitedMethod · 0.95
mouseMovedMethod · 0.95
ImageJMethod · 0.45
mouseDownInHandleMethod · 0.45
mouseExitedMethod · 0.45
mouseMovedMethod · 0.45

Calls 12

spaceBarDownMethod · 0.95
getToolIdMethod · 0.95
getPlugInToolMethod · 0.95
getToolNameMethod · 0.95
getStateMethod · 0.95
isHandleMethod · 0.95
overOverlayLabelMethod · 0.95
containsMethod · 0.95
getRoiMethod · 0.45
getWindowMethod · 0.45
equalsMethod · 0.45
getOverlayMethod · 0.45

Tested by

no test coverage detected