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

Method toolID

ij/src/main/java/ij/gui/Toolbar.java:1136–1155  ·  view source on GitHub ↗
(int x)

Source from the content-addressed store, hash-verified

1134
1135 // Returns the tool corresponding to the specified x coordinate
1136 private int toolID(int x) {
1137 if (x>buttonWidth*12+gapSize)
1138 x -= gapSize;
1139 int index = x/buttonWidth;
1140 switch (index) {
1141 case 0: return RECTANGLE;
1142 case 1: return OVAL;
1143 case 2: return POLYGON;
1144 case 3: return FREEROI;
1145 case 4: return lineType;
1146 case 5: return ANGLE;
1147 case 6: return POINT;
1148 case 7: return WAND;
1149 case 8: return TEXT;
1150 case 9: return MAGNIFIER;
1151 case 10: return HAND;
1152 case 11: return DROPPER;
1153 default: return index + 3;
1154 }
1155 }
1156
1157 private boolean inGap(int x) {
1158 return x>=(buttonWidth*12) && x<(buttonWidth*12+gapSize);

Callers 2

mousePressedMethod · 0.95
mouseMovedMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected