Example #1
0
 private void drag(WebPlotView pv, ScreenPt spt) {
   WebPlot plot = pv.getPrimaryPlot();
   _mouseInfo.setEnableAllPersistent(true);
   _mouseInfo.setEnableAllExclusive(false);
   _currentPt = plot.getImageWorkSpaceCoords(spt);
   _dataConnect.setData(makeSelectedObj(plot));
   _drawMan.redraw();
 }
Example #2
0
 private void end(WebPlotView pv) {
   _mouseInfo.setEnableAllPersistent(true);
   _mouseInfo.setEnableAllExclusive(false);
   setAttribute(makeSelection());
   if (_mode == Mode.SELECT) {
     releaseMouse();
     changeMode(Mode.EDIT);
     setupEdit();
   }
 }
Example #3
0
  private void begin(WebPlotView pv, ScreenPt spt) {
    WebPlot plot = pv.getPrimaryPlot();
    pv.fixScrollPosition();
    _mouseInfo.setEnableAllPersistent(true);
    _mouseInfo.setEnableAllExclusive(false);

    switch (_mode) {
      case SELECT:
        _firstPt = plot.getImageWorkSpaceCoords(spt);
        _currentPt = _firstPt;
        break;
      case EDIT:
        LineSelection sel = (LineSelection) pv.getAttribute(WebPlot.ACTIVE_DISTANCE);
        if (sel == null) {
          WebAssert.tst(false, "no RecSelection found in plot");
        }

        ImageWorkSpacePt ptAry[] = new ImageWorkSpacePt[] {sel.getPt1(), sel.getPt2()};

        int idx = findClosestPtIdx(plot, ptAry, spt);
        if (idx < 0) return;
        ScreenPt testPt = plot.getScreenCoords(ptAry[idx]);
        double dist = distance(testPt, spt);
        if (dist < EDIT_DISTANCE && dist > -1) {
          int oppoIdx = idx == 0 ? 1 : 0;
          _firstPt = ptAry[oppoIdx];
          _currentPt = ptAry[idx];
        } else {
          _firstPt = plot.getImageWorkSpaceCoords(spt);
          _currentPt = _firstPt;
        }

        break;
      case OFF:
        releaseMouse();
        break;
      default:
        WebAssert.argTst(false, "only support for SelectType of SELECT EDIT, OFF");
        break;
    }
  }