import org.simantics.g2d.element.handler.impl.ConfigurableEdgeVisuals;
import org.simantics.g2d.element.handler.impl.ConnectionSelectionOutline;
import org.simantics.g2d.element.handler.impl.FillColorImpl;
+import org.simantics.g2d.element.handler.impl.SimpleElementLayers;
import org.simantics.g2d.element.handler.impl.TextImpl;
import org.simantics.g2d.elementclass.connection.EdgeClass.FixedTransform;
import org.simantics.scenegraph.g2d.G2DParentNode;
ConnectionSelectionOutline.INSTANCE,
ConnectionHandlerImpl.INSTANCE,
ConnectionSceneGraph.INSTANCE,
- //SimpleElementLayers.INSTANCE,
+ SimpleElementLayers.INSTANCE,
// Exists only loading connection visuals through ConnectionVisualsLoader
ConfigurableEdgeVisuals.DEFAULT,
@Override
public boolean pickTest(IElement e, Shape s, PickPolicy policy) {
+ RouteGraphNode rgn = e.getHint(KEY_RG_NODE);
+ if (rgn == null) {
+ return false;
+ }
RouteGraph rg = getRouteGraph(e);
if (rg == null)
return false;
if (e.containsHint(KEY_USE_TOLERANCE_IN_SELECTION))
tolerance = getTolerance(e);
else
- tolerance = (bounds.getHeight()+bounds.getHeight()) * 0.25;
+ tolerance = Math.max((bounds.getHeight()+bounds.getHeight()) * 0.25, rgn.getSelectionStrokeWidth() / 2);
Object node = rg.pickLine(bounds.getCenterX(), bounds.getCenterY(), tolerance);
return node != null;
}
@Override
public Rectangle2D getBounds(IElement e, Rectangle2D size) {
- RouteGraph rg = getRouteGraph(e);
- if (rg != null) {
+ RouteGraphNode rgn = e.getHint(KEY_RG_NODE);
+ if (rgn != null) {
if (size == null)
size = new Rectangle2D.Double();
- rg.getBounds(size);
+ size.setRect(rgn.getBoundsInLocal());
}
return size;
}