import java.awt.Dimension;\r
import java.awt.Graphics;\r
import java.awt.Graphics2D;\r
-import java.awt.Rectangle;\r
import java.awt.RenderingHints;\r
import java.awt.event.ComponentAdapter;\r
import java.awt.event.ComponentEvent;\r
import java.awt.image.VolatileImage;\r
\r
import org.simantics.h2d.editor.IDiagramEditor;\r
-import org.simantics.h2d.editor.impl.DiagramEditor;\r
import org.simantics.h2d.event.ClickEvent;\r
import org.simantics.h2d.event.DragEvent;\r
import org.simantics.h2d.event.DragEventPhase;\r
import org.simantics.h2d.event.KeyboardEvent;\r
import org.simantics.h2d.event.Modifiers;\r
+import org.simantics.h2d.event.ReleaseEvent;\r
import org.simantics.h2d.event.WheelEvent;\r
import org.simantics.scenegraph.g2d.G2DRenderingHints;\r
\r
if(dragEvent != null && dragEvent.phase == DragEventPhase.dragUpdate) {\r
dragEvent.phase = DragEventPhase.dragEnd;\r
editor.handleEvent(dragEvent);\r
- }\r
+ } \r
+ \r
+ ReleaseEvent event = new ReleaseEvent(\r
+ Modifiers.modifierString(e.getButton(), e.isControlDown(), e.isAltDown(), e.isShiftDown()),\r
+ editor.screenToDiagram(e.getPoint()),\r
+ e.getLocationOnScreen()\r
+ );\r
+ event.pickedElements = dragEvent.pickedElements;\r
+ editor.handleEvent(event);\r
}\r
\r
@Override\r
--- /dev/null
+package org.simantics.h2d.event;\r
+\r
+import java.awt.geom.Point2D;\r
+import java.util.List;\r
+\r
+import org.simantics.h2d.element.IElement;\r
+\r
+public class ReleaseEvent implements ILocatableEvent {\r
+ final public String modifiers;\r
+\r
+ // Release location in diagram coordinates\r
+ final public Point2D point;\r
+ final public Point2D dispPoint;\r
+\r
+ public List<IElement> pickedElements;\r
+\r
+ public ReleaseEvent(String modifiers, Point2D point, Point2D dispPoint) {\r
+ this.modifiers = modifiers;\r
+ this.dispPoint = dispPoint;\r
+ this.point = point;\r
+ }\r
+ \r
+ @Override\r
+ public Point2D getLocation() {\r
+ return point;\r
+ }\r
+\r
+ @Override\r
+ public List<IElement> getPickedElements() {\r
+ return pickedElements;\r
+ }\r
+\r
+ @Override\r
+ public String getType() {\r
+ return getType(modifiers);\r
+ }\r
+ \r
+ public static String getType(String modifiers) {\r
+ return "release(" + modifiers + ")";\r
+ }\r
+\r
+}\r
import org.eclipse.ui.IWorkbenchActionConstants;\r
import org.eclipse.ui.IWorkbenchPartSite;\r
import org.simantics.h2d.editor.IDiagramEditor;\r
-import org.simantics.h2d.event.ClickEvent;\r
import org.simantics.h2d.event.IEvent;\r
+import org.simantics.h2d.event.ReleaseEvent;\r
import org.simantics.h2d.event.handler.IEventHandler;\r
import org.simantics.ui.action.GraphMenuManager;\r
\r
\r
@Override\r
public boolean handle(final IDiagramEditor editor, IEvent _event) {\r
- final ClickEvent event = (ClickEvent)_event;\r
+ final ReleaseEvent event = (ReleaseEvent)_event;\r
control.getDisplay().asyncExec(new Runnable() {\r
\r
@Override\r
editor.addEventHandler(1, "key(C)", new CreateCloud());\r
editor.addEventHandler(1, "drag(alt+left)", new ConnectDependency());\r
editor.addEventHandler(1, "drag(alt+right)", new ConnectFlow());\r
- editor.addEventHandler(1, "click(right)", openContextMenu); \r
+ editor.addEventHandler(1, "release(right)", openContextMenu); \r
\r
canvas = new EditorCanvas(editor);\r
frame.add(canvas);\r
import java.awt.geom.AffineTransform;\r
import java.awt.geom.Rectangle2D;\r
import java.util.List;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
import org.simantics.h2d.action.IAction;\r
import org.simantics.h2d.editor.IDiagramEditor;\r
import org.simantics.h2d.element.IElement;\r
import org.simantics.h2d.node.TextNode;\r
import org.simantics.objmap.annotations.GraphType;\r
import org.simantics.objmap.annotations.RelatedValue;\r
-import org.simantics.objmap.annotations.UpdateMethod;\r
import org.simantics.scenegraph.g2d.G2DParentNode;\r
-import org.simantics.sysdyn.SysdynResource;\r
\r
@GraphType("http://www.simantics.org/Sysdyn-1.0/Auxiliary")\r
public class TextElement extends RectangularElement implements Movable, Connectable, IEventHandler {\r
} \r
\r
boolean oldHasEquation = false;\r
+ boolean hasEquation = true;\r
+ /*\r
boolean hasEquation = false;\r
\r
@UpdateMethod\r
} \r
return false;\r
}\r
+ */\r
}\r