/* * @(#)HandleTracker.java * * Project: JHotdraw - a GUI framework for technical drawings * http://www.jhotdraw.org * http://jhotdraw.sourceforge.net * Copyright: © by the original author(s) and all contributors * License: Lesser GNU Public License (LGPL) * http://www.opensource.org/licenses/lgpl-license.html */ package CH.ifa.draw.standard; import java.awt.*; import java.awt.event.MouseEvent; import CH.ifa.draw.framework.*; /** * HandleTracker implements interactions with the handles of a Figure. * * @see SelectionTool * * @version <$CURRENT_VERSION$> */ public class HandleTracker extends AbstractTool { private Handle fAnchorHandle; public HandleTracker(DrawingView view, Handle anchorHandle) { super(view); fAnchorHandle = anchorHandle; } public void mouseDown(MouseEvent e, int x, int y) { super.mouseDown(e, x, y); fAnchorHandle.invokeStart(x, y, view()); } public void mouseDrag(MouseEvent e, int x, int y) { super.mouseDrag(e, x, y); fAnchorHandle.invokeStep(x, y, fAnchorX, fAnchorY, view()); } public void mouseUp(MouseEvent e, int x, int y) { super.mouseDrag(e, x, y); fAnchorHandle.invokeEnd(x, y, fAnchorX, fAnchorY, view()); } public void activate() { // suppress clearSelection() in superclas by providing an empty implementation } }