X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2FSCLScenegraph.java;fp=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2FSCLScenegraph.java;h=82115ef0e0825e2c9b8b2c69793f6bffd015344b;hb=f48fa9bd04b1802047c1eba99ad73eb4234a46c2;hp=db65b4de38c33193a1c1fe7e9492c799ab4544e2;hpb=414dd6f06a51268cbbf7bc8c1b1ae0a1e3d71f89;p=simantics%2Fplatform.git
diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java
index db65b4de3..82115ef0e 100644
--- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java
+++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java
@@ -51,6 +51,7 @@ import org.simantics.g2d.canvas.ICanvasContext;
import org.simantics.g2d.diagram.DiagramHints;
import org.simantics.g2d.diagram.IDiagram;
import org.simantics.g2d.diagram.handler.DataElementMap;
+import org.simantics.g2d.diagram.participant.ElementPainter.SelectionShapeNode;
import org.simantics.g2d.diagram.participant.Selection;
import org.simantics.g2d.element.IElement;
import org.simantics.g2d.scenegraph.ICanvasSceneGraphProvider;
@@ -964,9 +965,31 @@ public class SCLScenegraph {
if (!hasContent)
return;
String svg = printSVGDocument(doc);
- parentBuilder.append(MAIN_SECTION, "");
- parentBuilder.append(MAIN_SECTION, svg);
- parentBuilder.append(MAIN_SECTION, "\n");
+ if (node instanceof SelectionShapeNode) {
+ SingleElementNode parentSEN = (SingleElementNode)NodeUtil.getNearestParentOfType(node, SingleElementNode.class);
+ if(parentSEN != null) {
+ String key = getKey(parentSEN);
+ RenderSVGContext parentBuilder2 = getParentBuilder(parentSEN);
+ parentBuilder2.append(SELECTION_SECTION, "\n");
+ parentBuilder2.append(SELECTION_SECTION, svg);
+ parentBuilder2.append(SELECTION_SECTION, "\n");
+
+ parentBuilder2.append(SELECTION_MASK_SECTION, "\n");
+ Rectangle2D rect = node.getBounds();
+ // NaN
+ if(rect.getHeight() == rect.getHeight() && rect.getWidth() == rect.getWidth()) {
+ parentBuilder2.append(SELECTION_MASK_SECTION,"");
+ }
+ parentBuilder2.append(SELECTION_MASK_SECTION,"\n");
+ }
+ } else {
+ parentBuilder.append(MAIN_SECTION, "");
+ parentBuilder.append(MAIN_SECTION, svg);
+ parentBuilder.append(MAIN_SECTION, "\n");
+ }
} catch (Exception e) {
// TODO: There are nodes that do not behave well when rendered to SVG. For backwards compatibility, we don't handle the exceptions.
}