-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g2d.participant;\r
-\r
-import java.awt.geom.Point2D;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.simantics.g2d.canvas.impl.AbstractCanvasParticipant;\r
-import org.simantics.g2d.canvas.impl.DependencyReflection.Dependency;\r
-\r
-/**\r
- * Participant that enables grabbing of canvas.\r
- * \r
- * @See {@link HandPainter} Paints grabbing of canvas\r
- * @author Toni Kalajainen\r
- */\r
-public class CanvasGrab extends AbstractCanvasParticipant {\r
-\r
- @Dependency TransformUtil util;\r
- \r
- public Map<Integer, PointerInfo> grabInfo = new HashMap<Integer, PointerInfo>();\r
- \r
- public PointerInfo grabCanvas(int id, Point2D pos)\r
- { \r
- PointerInfo result = new PointerInfo(pos, id);\r
- result.currentPos = pos; \r
- grabInfo.put(id, result); \r
- return result;\r
- }\r
- \r
- public void releaseCanvas(int id)\r
- {\r
- grabInfo.remove(id);\r
- }\r
- \r
- /** Info of pointers with left button down */\r
- public static final class PointerInfo {\r
- public final int mouseId;\r
- // Anchoring position in control coordinates \r
- public Point2D anchorPos;\r
- public Point2D currentPos;\r
- public PointerInfo(Point2D anchorPos, int mouseId) {\r
- this.anchorPos = anchorPos;\r
- this.mouseId = mouseId;\r
- } \r
- }\r
- \r
- public Map<Integer, PointerInfo> getGrabInfo()\r
- {\r
- return grabInfo;\r
- }\r
- \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.participant;
+
+import java.awt.geom.Point2D;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.simantics.g2d.canvas.impl.AbstractCanvasParticipant;
+import org.simantics.g2d.canvas.impl.DependencyReflection.Dependency;
+
+/**
+ * Participant that enables grabbing of canvas.
+ *
+ * @See {@link HandPainter} Paints grabbing of canvas
+ * @author Toni Kalajainen
+ */
+public class CanvasGrab extends AbstractCanvasParticipant {
+
+ @Dependency TransformUtil util;
+
+ public Map<Integer, PointerInfo> grabInfo = new HashMap<Integer, PointerInfo>();
+
+ public PointerInfo grabCanvas(int id, Point2D pos)
+ {
+ PointerInfo result = new PointerInfo(pos, id);
+ result.currentPos = pos;
+ grabInfo.put(id, result);
+ return result;
+ }
+
+ public void releaseCanvas(int id)
+ {
+ grabInfo.remove(id);
+ }
+
+ /** Info of pointers with left button down */
+ public static final class PointerInfo {
+ public final int mouseId;
+ // Anchoring position in control coordinates
+ public Point2D anchorPos;
+ public Point2D currentPos;
+ public PointerInfo(Point2D anchorPos, int mouseId) {
+ this.anchorPos = anchorPos;
+ this.mouseId = mouseId;
+ }
+ }
+
+ public Map<Integer, PointerInfo> getGrabInfo()
+ {
+ return grabInfo;
+ }
+
+}