However, this example does not cover defining an SVG object using a path string rather it shows how to encode the path string using the following code block:
geo.add(new go.PathFigure(0, 0)
.add(new go.PathSegment(go.PathSegment.Line, w, 0))
.add(new go.PathSegment(go.PathSegment.Line, w, h - p1))
.add(new go.PathSegment(go.PathSegment.Arc, 0, 90, w - p1, h - p1, p1, p1))
.add(new go.PathSegment(go.PathSegment.Line, p1, h))
.add(new go.PathSegment(go.PathSegment.Arc, 90, 90, p1, h - p1, p1, p1).close()));
Does GoJS support using just the path string to define the SVG object and if so how would I accomplish this?
Last question, in cases where I want to use a regular node shape for a specific node rather than custom geometry, would I need to specify the SVG path of that regular shape?
Example:
function geoFunc(geoname) {
var geo = icons[geoname];
if (geo === undefined) geo = icons["heart"]; // use this for an unknown icon name
if (typeof geo === "string") {
geo = icons[geoname] = go.Geometry.fillPath(geo); // fill each geometry
}
return geo;
}
Rather than having the undefined icons default to a heart, how would I default to a predefined shape like a circle or a RoundedRectangle?
The idea that I’m working off of is that either the node has a geometry that is defined or it is a roundedrectangle.
function geoFunc(geoname) {
var geo = icons[geoname];
if (geo === undefined) geo = icons["circle"]; // use this for an unknown icon name
if (typeof geo === "string") {
geo = icons[geoname] = go.Geometry.fillPath(geo); // fill each geometry
}
if (geo == "none") {
// Case where shape is set to Rounded Rectangle
}
return geo;
}
Since my geometries are rather fixed and any case where im not using a custom geometry the shape needs to be a rounded rectangle. Is this possible without predefining the SVG for the rounded rectangle.