Hi,
I am trying to use svg string in my palette by referring “tiger” example.
My problem here is my svg code contains additional information in it which is not available in tiger svg. I.e,
rect, ellipse, circle, clip-path, transform, linearGradient, gradientUnits, stroke-miterlimit, enable-background, polygon, points, overflow and so on…
How to use these kind of svg in my palette?
I’m sorry, but I don’t understand your situation and what you are trying to accomplish.
Geometry objects only apply to Shapes. A Shape can have a complex Geometry, but it only has a single stroke brush, a single fill brush, and a single background brush. So if you have SVG with multiple “shapes”, you cannot represent that with only a single GoJS Shape. You have to use Panels containing multiple GraphObjects.
Why is using a Picture insufficient in your Palette?
Lets take tiger example itself to explain why Picture is insufficient in my palette.
In the tiger example, observe that the eye of tiger is in “Green” color.
In the run time I want to change its color to “Red” for one instance and “yellow” in another instance.
Is it possible to do that using picture object?
I have sent you another email message with an attached zip file, “svgParse.zi_”, holding the unfinished and unsupported implementation of an SvgParse class.
What about convert polyline/polygon into path and keep using the tiger.html code?
function convertSVGPolygonPolylineToPath(string) {
return string
// close path for polygon
.replace(/(<polygon[\w\W]+?)points=(["'])([\.\d, ]+?)(["'])/g, "$1d=$2M$3z$4")
// dont close path for polyline
.replace(/(<polyline[\w\W]+?)points=(["'])([\.\d, ]+?)(["'])/g, "$1d=$2M$3$4")
.replace(/poly(gon|line)/g, "path");
}