Java Code Examples for javafx.scene.input.MouseEvent#getY()

The following examples show how to use javafx.scene.input.MouseEvent#getY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChartZoomManager.java    From jfxutils with Apache License 2.0 6 votes vote down vote up
private void onMousePressed( MouseEvent mouseEvent ) {
	double x = mouseEvent.getX();
	double y = mouseEvent.getY();

	Rectangle2D plotArea = chartInfo.getPlotArea();
	DefaultChartInputContext context = new DefaultChartInputContext( chartInfo, x, y );
	zoomMode = axisConstraintStrategy.getConstraint(context);

	if ( zoomMode == AxisConstraint.Both ) {
		selectRect.setTranslateX( x );
		selectRect.setTranslateY( y );
		rectX.set( x );
		rectY.set( y );

	} else if ( zoomMode == AxisConstraint.Horizontal ) {
		selectRect.setTranslateX( x );
		selectRect.setTranslateY( plotArea.getMinY() );
		rectX.set( x );
		rectY.set( plotArea.getMaxY() );

	} else if ( zoomMode == AxisConstraint.Vertical ) {
		selectRect.setTranslateX( plotArea.getMinX() );
		selectRect.setTranslateY( y );
		rectX.set( plotArea.getMaxX() );
		rectY.set( y );
	}
}
 
Example 2
Source File: PanHandlerFX.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.
 * 
 * @param canvas  the JavaFX canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Plot plot = canvas.getChart().getPlot();
    if (!(plot instanceof Pannable)) {
        canvas.clearLiveHandler();
        return;
    }
    Pannable pannable = (Pannable) plot;
    if (pannable.isDomainPannable() || pannable.isRangePannable()) {
        Point2D point = new Point2D.Double(e.getX(), e.getY());
        Rectangle2D dataArea = canvas.findDataArea(point);
        if (dataArea != null && dataArea.contains(point)) {
            this.panW = dataArea.getWidth();
            this.panH = dataArea.getHeight();
            this.panLast = point;
            canvas.setCursor(javafx.scene.Cursor.MOVE);
        }
    }
    // the actual panning occurs later in the mouseDragged() method
}
 
Example 3
Source File: ParetoPanel.java    From charts with Apache License 2.0 6 votes vote down vote up
/**
 * Handles the clicks on DataDots and ParetoBars
 * @param EVT
 */
private void handleMouseEvents(final MouseEvent EVT) {
    final EventType<? extends MouseEvent> TYPE = EVT.getEventType();
    double                                X    = EVT.getX();
    double                                Y    = EVT.getY();

    if(MouseEvent.MOUSE_PRESSED.equals(TYPE)) {
        for (DataDot dot: dataDots) {
            if(insideDataDot(X,Y,dot)) {
                showPopup(EVT.getScreenX(),EVT.getScreenY(),dot);
                return;
            }
        }
        for(ParetoBar bar: paretoModel.getData()) {
            if(insideBar(X,Y,bar)) {
                if(EVT.isShiftDown()){
                    filterChartByBar(bar);
                }else {
                    cascadeIntoBar(bar);
                }
                break;
            }
        }

    }
}
 
Example 4
Source File: TargetEditorController.java    From ShootOFF with GNU General Public License v3.0 6 votes vote down vote up
private void drawPolygon(MouseEvent event) {
	final int VERTEX_RADIUS = 3;

	final Circle vertexDot = new Circle(event.getX(), event.getY(), VERTEX_RADIUS);
	freeformShapes.add(vertexDot);
	canvasPane.getChildren().add(vertexDot);

	if (freeformPoints.size() > 0) {
		final double lastX = freeformPoints.get(freeformPoints.size() - 2);
		final double lastY = freeformPoints.get(freeformPoints.size() - 1);
		final Line edge = new Line(lastX, lastY, event.getX(), event.getY());

		freeformShapes.push(edge);
		canvasPane.getChildren().add(edge);
	}

	freeformPoints.add(event.getX());
	freeformPoints.add(event.getY());
}
 
Example 5
Source File: TargetEditorController.java    From ShootOFF with GNU General Public License v3.0 6 votes vote down vote up
private void drawTempPolygonEdge(MouseEvent event) {
	// Need at least one point
	if (freeformPoints.size() < 2) return;

	if (freeformEdge.isPresent()) canvasPane.getChildren().remove(freeformEdge.get());

	final double lastX = freeformPoints.get(freeformPoints.size() - 2);
	final double lastY = freeformPoints.get(freeformPoints.size() - 1);

	final Line tempEdge = new Line(lastX, lastY, event.getX(), event.getY());
	final double DASH_OFFSET = 5;

	tempEdge.getStrokeDashArray().addAll(DASH_OFFSET, DASH_OFFSET);
	freeformEdge = Optional.of(tempEdge);
	canvasPane.getChildren().add(tempEdge);
}
 
Example 6
Source File: PanHandlerFX.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.
 * 
 * @param canvas  the JavaFX canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Plot plot = canvas.getChart().getPlot();
    if (!(plot instanceof Pannable)) {
        canvas.clearLiveHandler();
        return;
    }
    Pannable pannable = (Pannable) plot;
    if (pannable.isDomainPannable() || pannable.isRangePannable()) {
        Point2D point = new Point2D.Double(e.getX(), e.getY());
        Rectangle2D dataArea = canvas.findDataArea(point);
        if (dataArea != null && dataArea.contains(point)) {
            this.panW = dataArea.getWidth();
            this.panH = dataArea.getHeight();
            this.panLast = point;
            canvas.setCursor(javafx.scene.Cursor.MOVE);
        }
    }
    // the actual panning occurs later in the mouseDragged() method
}
 
Example 7
Source File: ChartPanManager.java    From jfxutils with Apache License 2.0 6 votes vote down vote up
private void drag( MouseEvent event ) {
	if ( !dragging )
		return;

	if ( panMode == AxisConstraint.Both || panMode == AxisConstraint.Horizontal ) {
		double dX = ( event.getX() - lastX ) / -xAxis.getScale();
		lastX = event.getX();
		xAxis.setAutoRanging( false );
		xAxis.setLowerBound( xAxis.getLowerBound() + dX );
		xAxis.setUpperBound( xAxis.getUpperBound() + dX );
	}

	if ( panMode == AxisConstraint.Both || panMode == AxisConstraint.Vertical ) {
		double dY = ( event.getY() - lastY ) / -yAxis.getScale();
		lastY = event.getY();
		yAxis.setAutoRanging( false );
		yAxis.setLowerBound( yAxis.getLowerBound() + dY );
		yAxis.setUpperBound( yAxis.getUpperBound() + dY );
	}
}
 
Example 8
Source File: PanHandlerFX.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.
 * 
 * @param canvas  the JavaFX canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Plot plot = canvas.getChart().getPlot();
    if (!(plot instanceof Pannable)) {
        canvas.clearLiveHandler();
        return;
    }
    Pannable pannable = (Pannable) plot;
    if (pannable.isDomainPannable() || pannable.isRangePannable()) {
        Point2D point = new Point2D.Double(e.getX(), e.getY());
        Rectangle2D dataArea = canvas.findDataArea(point);
        if (dataArea != null && dataArea.contains(point)) {
            this.panW = dataArea.getWidth();
            this.panH = dataArea.getHeight();
            this.panLast = point;
            canvas.setCursor(javafx.scene.Cursor.MOVE);
        }
    }
    // the actual panning occurs later in the mouseDragged() method
}
 
Example 9
Source File: PanHandlerFX.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Handles a mouse dragged event by calculating the distance panned and
 * updating the axes accordingly.
 * 
 * @param canvas  the JavaFX canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
public void handleMouseDragged(ChartCanvas canvas, MouseEvent e) {
    if (this.panLast == null) {
        //handle panning if we have a start point else unregister
        canvas.clearLiveHandler();
        return;
    }

    JFreeChart chart = canvas.getChart();
    double dx = e.getX() - this.panLast.getX();
    double dy = e.getY() - this.panLast.getY();
    if (dx == 0.0 && dy == 0.0) {
        return;
    }
    double wPercent = -dx / this.panW;
    double hPercent = dy / this.panH;
    boolean old = chart.getPlot().isNotify();
    chart.getPlot().setNotify(false);
    Pannable p = (Pannable) chart.getPlot();
    PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo();
    if (p.getOrientation().isVertical()) {
        p.panDomainAxes(wPercent, info, this.panLast);
        p.panRangeAxes(hPercent, info, this.panLast);
    }
    else {
        p.panDomainAxes(hPercent, info, this.panLast);
        p.panRangeAxes(wPercent, info, this.panLast);
    }
    this.panLast = new Point2D.Double(e.getX(), e.getY());
    chart.getPlot().setNotify(old);
}
 
Example 10
Source File: TaPanHandlerFX.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Handles a mouse dragged event by calculating the distance panned and
 * updating the axes accordingly.
 *
 * @param canvas  the JavaFX canvas ({@code null} not permitted).
 * @param e  the mouse event ({@code null} not permitted).
 */
@Override
public void handleMouseDragged(TaChartCanvas canvas, MouseEvent e) {
    if (this.panLast == null) {
        //handle panning if we have a start point else unregister
        canvas.clearLiveHandler();
        return;
    }

    JFreeChart chart = canvas.getChart();
    double dx = e.getX() - this.panLast.getX();
    double dy = e.getY() - this.panLast.getY();
    if (dx == 0.0 && dy == 0.0) {
        return;
    }
    double wPercent = -dx / this.panW;
    double hPercent = dy / this.panH;
    boolean old = chart.getPlot().isNotify();
    chart.getPlot().setNotify(false);
    Pannable p = (Pannable) chart.getPlot();
    PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo();
    if (p.getOrientation().isVertical()) {
        p.panDomainAxes(wPercent, info, this.panLast);
        p.panRangeAxes(hPercent, info, this.panLast);
    }
    else {
        p.panDomainAxes(hPercent, info, this.panLast);
        p.panRangeAxes(wPercent, info, this.panLast);
    }
    this.panLast = new Point2D.Double(e.getX(), e.getY());
    chart.getPlot().setNotify(old);
}
 
Example 11
Source File: ZoomHandlerFX.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.
 * 
 * @param canvas  the JavaFX canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Point2D pt = new Point2D.Double(e.getX(), e.getY());
    Rectangle2D dataArea = canvas.findDataArea(pt);
    if (dataArea != null) {
        this.startPoint = ShapeUtilities.getPointInRectangle(e.getX(),
                e.getY(), dataArea);
    } else {
        this.startPoint = null;
        canvas.clearLiveHandler();
    }
}
 
Example 12
Source File: ImageMaskController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
@FXML
public void circleReleased(MouseEvent event) {
    if (isPickingColor.get() || maskCircleLine == null || !maskCircleLine.isVisible()
            || !maskPane.getChildren().contains(maskCircleLine)
            || (mouseX == event.getX() && mouseY == event.getY())) {
        return;
    }
    scrollPane.setPannable(true);
    double offsetX = maskCircleLine.getLayoutX() + event.getX() - mouseX - imageView.getLayoutX();
    double offsetY = maskCircleLine.getLayoutY() + event.getY() - mouseY - imageView.getLayoutY();
    double x = offsetX * getImageWidth() / imageView.getBoundsInParent().getWidth();
    double y = offsetY * getImageHeight() / imageView.getBoundsInParent().getHeight();

    if (x <= 0 - maskCircleData.getRadius()) {
        x = 0 - maskCircleData.getRadius() + 1;
    }
    if (x >= getImageWidth() + maskCircleData.getRadius()) {
        x = getImageWidth() + maskCircleData.getRadius() - 1;
    }
    if (y <= 0 - maskCircleData.getRadius()) {
        y = 0 - maskCircleData.getRadius() + 1;
    }
    if (y >= getImageHeight() + maskCircleData.getRadius()) {
        y = getImageHeight() + maskCircleData.getRadius() - 1;
    }

    maskCircleData.setCenterX(x);
    maskCircleData.setCenterY(y);
    drawMaskCircleLine();
}
 
Example 13
Source File: AnchorHandlerFX.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Handles a mouse clicked event by setting the anchor point for the
 * canvas and redrawing the chart (the anchor point is a reference point
 * used by the chart to determine crosshair lines).
 * 
 * @param canvas  the chart canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMouseClicked(ChartCanvas canvas, MouseEvent e) {
    if (this.mousePressedPoint == null) {
        return;
    }
    Point2D currPt = new Point2D.Double(e.getX(), e.getY());
    if (this.mousePressedPoint.distance(currPt) < 2) {
        canvas.setAnchor(currPt);
    }
    this.mousePressedPoint = null;
}
 
Example 14
Source File: ZoomHandlerFX.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.
 * 
 * @param canvas  the JavaFX canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Point2D pt = new Point2D.Double(e.getX(), e.getY());
    Rectangle2D dataArea = canvas.findDataArea(pt);
    if (dataArea != null) {
        this.startPoint = ShapeUtilities.getPointInRectangle(e.getX(),
                e.getY(), dataArea);
    } else {
        this.startPoint = null;
        canvas.clearLiveHandler();
    }
}
 
Example 15
Source File: ImagePlot.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** setOnMouseMoved */
private void mouseMove(final MouseEvent e)
{
    final Point2D current = new Point2D(e.getX(), e.getY());
    mouse_current = Optional.of(current);

    // While zooming, when mouse is quickly dragged outside the widget
    // and then released, the 'mouseUp' event is sometimes missing.
    // --> When seeing an active mouse move w/o button press,
    //     treat that just like a release.
    if (mouse_mode.ordinal() >= MouseMode.ZOOM_IN_X.ordinal()  &&  !e.isPrimaryButtonDown())
    {
        mouseUp(e);
        return;
    }

    PlotCursors.setCursor(this, mouse_mode);

    final Point2D start = mouse_start.orElse(null);
    switch (mouse_mode)
    {
    case PAN_PLOT:
        if (start != null)
        {
            x_axis.pan(mouse_start_x_range, x_axis.getValue((int)start.getX()), x_axis.getValue((int)current.getX()));
            y_axis.pan(mouse_start_y_range, y_axis.getValue((int)start.getY()), y_axis.getValue((int)current.getY()));
        }
        break;
    case ZOOM_IN_X:
    case ZOOM_IN_Y:
    case ZOOM_IN_PLOT:
        // Show mouse feedback for ongoing zoom
        requestRedraw();
        break;
    default:
    }
    if (! crosshair)
        updateLocationInfo(e.getX(), e.getY());
}
 
Example 16
Source File: JavaFXPanelHelper.java    From jbox2d with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private static Vec2 toVec(MouseEvent mouseEvent) {
  return new Vec2((float) mouseEvent.getX(), (float) mouseEvent.getY());
}
 
Example 17
Source File: DispatchHandlerFX.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void handleMouseMoved(ChartCanvas canvas, MouseEvent e) {
    Point2D currPt = new Point2D.Double(e.getX(), e.getY());
    canvas.dispatchMouseMovedEvent(currPt, e);
 }
 
Example 18
Source File: ViewshedLocationController.java    From arcgis-runtime-samples-java with Apache License 2.0 4 votes vote down vote up
public void initialize() {
  // create a scene and add a basemap to it
  ArcGISScene scene = new ArcGISScene();
  scene.setBasemap(Basemap.createImagery());
  sceneView.setArcGISScene(scene);

  // add base surface for elevation data
  Surface surface = new Surface();
  final String localElevationImageService = "http://scene.arcgis" +
      ".com/arcgis/rest/services/BREST_DTM_1M/ImageServer";
  surface.getElevationSources().add(new ArcGISTiledElevationSource(localElevationImageService));
  scene.setBaseSurface(surface);

  // add a scene layer
  final String buildings = "http://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Brest/SceneServer/layers/0";
  ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(buildings);
  scene.getOperationalLayers().add(sceneLayer);

  // create a viewshed from the camera
  Point location = new Point(-4.50, 48.4,100.0);
  LocationViewshed viewshed = new LocationViewshed(location, headingSlider.getValue(), pitchSlider.getValue(),
      horizontalAngleSlider.getValue(), verticalAngleSlider.getValue(), minDistanceSlider.getValue(),
      maxDistanceSlider.getValue());

  // set the camera
  Camera camera = new Camera(location, 200.0, 20.0, 70.0, 0.0);
  sceneView.setViewpointCamera(camera);

  // create an analysis overlay to add the viewshed to the scene view
  AnalysisOverlay analysisOverlay = new AnalysisOverlay();
  analysisOverlay.getAnalyses().add(viewshed);
  sceneView.getAnalysisOverlays().add(analysisOverlay);

  // create a listener to update the viewshed location when the mouse moves
  EventHandler<MouseEvent> mouseMoveEventHandler = new EventHandler<MouseEvent>() {
    @Override
    public void handle(MouseEvent event) {
      Point2D point2D = new Point2D(event.getX(), event.getY());
      ListenableFuture<Point> pointFuture = sceneView.screenToLocationAsync(point2D);
      pointFuture.addDoneListener(() -> {
        try {
          Point point = pointFuture.get();
          PointBuilder pointBuilder = new PointBuilder(point);
          pointBuilder.setZ(point.getZ() + 50.0);
          viewshed.setLocation(pointBuilder.toGeometry());
          // add listener back
          sceneView.setOnMouseMoved(this);
        } catch (InterruptedException | ExecutionException e) {
          e.printStackTrace();
        }
      });
      // disable listener until location is updated (for performance)
      sceneView.setOnMouseMoved(null);
    }
  };
  // remove the default listener for mouse move events
  sceneView.setOnMouseMoved(null);

  // click to start/stop moving viewshed with mouse
  sceneView.setOnMouseClicked(event -> {
    if (event.isStillSincePress() && event.getButton() == MouseButton.PRIMARY) {
      if (sceneView.getOnMouseMoved() == null) {
        sceneView.setOnMouseMoved(mouseMoveEventHandler);
      } else {
        sceneView.setOnMouseMoved(null);
      }
    }
  });

  // toggle visibility
  visibilityToggle.selectedProperty().addListener(e -> viewshed.setVisible(visibilityToggle.isSelected()));
  visibilityToggle.textProperty().bind(Bindings.createStringBinding(() -> visibilityToggle.isSelected() ? "ON" :
      "OFF", visibilityToggle.selectedProperty()));
  frustumToggle.selectedProperty().addListener(e -> viewshed.setFrustumOutlineVisible(frustumToggle.isSelected()));
  frustumToggle.textProperty().bind(Bindings.createStringBinding(() -> frustumToggle.isSelected() ? "ON" :
      "OFF", frustumToggle.selectedProperty()));
  // heading slider
  headingSlider.valueProperty().addListener(e -> viewshed.setHeading(headingSlider.getValue()));
  // pitch slider
  pitchSlider.valueProperty().addListener(e -> viewshed.setPitch(pitchSlider.getValue()));
  // horizontal angle slider
  horizontalAngleSlider.valueProperty().addListener(e -> viewshed.setHorizontalAngle(horizontalAngleSlider.getValue()));
  // vertical angle slider
  verticalAngleSlider.valueProperty().addListener(e -> viewshed.setVerticalAngle(verticalAngleSlider
      .getValue()));
  // distance sliders
  minDistanceSlider.valueProperty().addListener(e -> viewshed.setMinDistance(minDistanceSlider.getValue()));
  maxDistanceSlider.valueProperty().addListener(e -> viewshed.setMaxDistance(maxDistanceSlider.getValue()));
  // colors
  visibleColorPicker.setValue(Color.rgb(0, 255, 0, 0.8));
  visibleColorPicker.valueProperty().addListener(e -> Viewshed.setVisibleColor(colorToInt(visibleColorPicker
      .getValue())));
  obstructedColorPicker.setValue(Color.rgb(255, 0, 0, 0.8));
  obstructedColorPicker.valueProperty().addListener(e -> Viewshed.setObstructedColor(colorToInt(obstructedColorPicker
      .getValue())));
  frustumColorPicker.setValue(Color.rgb(0, 0, 255, 0.8));
  frustumColorPicker.valueProperty().addListener(e -> Viewshed.setFrustumOutlineColor(colorToInt(frustumColorPicker
      .getValue())));
}
 
Example 19
Source File: ImageMaskController.java    From MyBox with Apache License 2.0 4 votes vote down vote up
@FXML
public void bottomCenterHandlerReleased(MouseEvent event) {
    scrollPane.setPannable(true);
    if (isPickingColor.get()) {
        return;
    }

    if (maskRectangleLine != null && maskRectangleLine.isVisible()) {
        double offsetY = bottomCenterHandler.getLayoutY() + event.getY() - mouseY - imageView.getLayoutY();
        double y = offsetY * getImageHeight() / imageView.getBoundsInParent().getHeight();

        if (y > maskRectangleData.getSmallY()) {
            if (y <= 0) {
                y = 1;
            }
            maskRectangleData.setBigY(y);
            drawMaskRectangleLine();
        }
    }

    if (maskCircleLine != null && maskCircleLine.isVisible()) {
        double d = bottomCenterHandler.getLayoutY() + event.getY() - mouseY - topCenterHandler.getLayoutY();
        if (d > 0) {
            d = d * getImageHeight() / imageView.getBoundsInParent().getHeight();
            maskCircleData.setRadius(d / 2);
            drawMaskCircleLine();
        }
    }

    if (maskEllipseLine != null && maskEllipseLine.isVisible()) {
        double ry = (bottomCenterHandler.getLayoutY() + event.getY() - mouseY - topCenterHandler.getLayoutY()) / 2;
        if (ry > 0) {
            ry = ry * getImageHeight() / imageView.getBoundsInParent().getHeight();
            double rx = maskEllipseData.getRadiusX();
            double cx = maskEllipseData.getCenterX();
            double cy = maskEllipseData.getCenterY();

            maskEllipseData = new DoubleEllipse(cx - rx, cy - ry, cx + rx, cy + ry);
            drawMaskEllipseLine();
        }
    }

}
 
Example 20
Source File: AnchorHandlerFX.java    From jfreechart-fx with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Handles a mouse pressed event by recording the location of the mouse
 * pointer (so that later we can check that the click isn't part of a
 * drag).
 * 
 * @param canvas  the chart canvas.
 * @param e  the mouse event.
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    this.mousePressedPoint = new Point2D.Double(e.getX(), e.getY());
}