MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / mouse

Method mouse

src/org/opensourcephysics/frames/RasterFrame.java:382–406  ·  view source on GitHub ↗
(MouseEvent e, boolean pressed)

Source from the content-addressed store, hash-verified

380 }
381
382 void mouse(MouseEvent e, boolean pressed) {
383 // button three is used for popup menu
384 if(e.getButton()==MouseEvent.BUTTON3) {
385 return;
386 }
387 double x = drawingPanel.pixToX(e.getX());
388 double y = drawingPanel.pixToY(e.getY());
389 int i = indexFromPoint(x, y);
390 if(i==-1) {
391 return;
392 }
393 if(pressed) {
394 dragV = editValues[0];
395 int len = editValues.length;
396 for(int j = 0; j<len; j++) {
397 if(getAtIndex(i)==editValues[j]) {
398 dragV = editValues[(j+1)%len];
399 }
400 }
401 }
402 if(getAtIndex(i)!=dragV) {
403 setAtIndex(i, dragV);
404 drawingPanel.render();
405 }
406 }
407
408 /**
409 * Gets the x coordinate for the given index.

Callers 2

mousePressedMethod · 0.95
mouseDraggedMethod · 0.95

Calls 8

indexFromPointMethod · 0.95
getAtIndexMethod · 0.95
setAtIndexMethod · 0.95
getXMethod · 0.65
getYMethod · 0.65
renderMethod · 0.65
pixToXMethod · 0.45
pixToYMethod · 0.45

Tested by

no test coverage detected