Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* @(#)DefaultDragTracker.java
*
* Copyright (c) 1996-2010 by the original authors of JHotDraw and all its
* contributors. All rights reserved.
*
* You may not use, copy or modify this file, except in compliance with the
* license agreement you entered into with the copyright holders. For details
* see accompanying license terms.
*/
package org.jhotdraw.draw.tool;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.jhotdraw.draw.event.TransformEdit;
import org.jhotdraw.draw.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;
import java.util.*;
/**
* DefaultDragTracker implements interactions with the content area of a
* Figure.
*
* The DefaultDragTracker handles one of the three states of the
* SelectionTool. It comes into action, when the user presses
* the mouse button over the content area of a Figure.
*
* Design pattern:
* Name: Chain of Responsibility.
* Role: Handler.
* Partners: {@link SelectionTool} as Handler, {@link SelectAreaTracker} as
* Handler, {@link HandleTracker} as Handler.
*
* Design pattern:
* Name: State.
* Role: State.
* Partners: {@link SelectAreaTracker} as State, {@link SelectionTool} as
* Context, {@link HandleTracker} as State.
*
* @see SelectionTool
*
* @author Werner Randelshofer
* @version $Id: DefaultDragTracker.java 722 2010-11-26 08:49:25Z rawcoder $
*/
public class DefaultDragTracker extends AbstractTool implements DragTracker {
@Nullable
protected Figure anchorFigure;
/**
* The drag rectangle encompasses the bounds of all dragged figures.
*/
@Nullable
protected Rectangle2D.Double dragRect;
/**
* The previousOrigin holds the origin of all dragged figures of the
* previous mouseDragged event. This coordinate is constrained using
* the Constrainer of the DrawingView.
*/
protected Point2D.Double previousOrigin;
/**
* The anchorOrigin holds the origin of all dragged figures of the
* mousePressed event.
*/
protected Point2D.Double anchorOrigin;
/**
* The previousPoint holds the location of the mouse of the previous
* mouseDragged event. This coordinate is not constrained using
* the Constrainer of the DrawingView.
*/
protected Point2D.Double previousPoint;
/**
* The anchorPoint holds the location of the mouse of the
* mousePressed event. This coordinate is not constrained using
* the Constrainer of the DrawingView.
*/
protected Point2D.Double anchorPoint;
private boolean isDragging;
@Nullable
private HashSet