MCPcopy Index your code
hub / github.com/benfry/processing4 / updateMouse

Method updateMouse

app/src/processing/app/ui/EditorStatus.java:207–242  ·  view source on GitHub ↗
(MouseEvent e, boolean pressed)

Source from the content-addressed store, hash-verified

205
206
207 void updateMouse(MouseEvent e, boolean pressed) {
208 mouseState = NONE;
209 shiftDown = false;
210
211 if (e != null) {
212 int mouseX = e.getX();
213 shiftDown = e.isShiftDown();
214
215 if (mouseX > sizeW - buttonEach && mouseX < sizeW) {
216 mouseState = pressed ? COLLAPSE_PRESSED : COLLAPSE_ROLLOVER;
217
218 } else if (message != null && !message.isEmpty()) {
219 if (sizeW - 2 * buttonEach < mouseX) {
220 mouseState = pressed ? CLIPBOARD_PRESSED : CLIPBOARD_ROLLOVER;
221
222 } else if (url != null && mouseX > LEFT_MARGIN && mouseX < messageRight) {
223 mouseState = pressed ? URL_PRESSED : URL_ROLLOVER;
224 }
225 }
226 }
227
228 // only change on the rollover, no need to update on press
229 switch (mouseState) {
230 case CLIPBOARD_ROLLOVER:
231 case URL_ROLLOVER:
232 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
233 break;
234 case COLLAPSE_ROLLOVER:
235 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
236 break;
237 case NONE:
238 setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
239 break;
240 }
241 repaint();
242 }
243
244
245 static String findURL(String message) {

Callers 6

mouseEnteredMethod · 0.95
mousePressedMethod · 0.95
mouseReleasedMethod · 0.95
mouseExitedMethod · 0.95
mouseDraggedMethod · 0.95
mouseMovedMethod · 0.95

Calls 5

getXMethod · 0.80
isEmptyMethod · 0.80
repaintMethod · 0.80
setCursorMethod · 0.65
isShiftDownMethod · 0.45

Tested by

no test coverage detected