I have a use case where I’m greying out icon pictures based on disabled property of node.
Untitled (codepen.io)
This is working as expected when using default renderer.
But not working when using svg renderer. Can you verify if this is a issue with svg renderer?
Is there any other way to achieve the same result?
Currently if I rebuild parts after data model change greying out is reflected in svg rendering but I know this is not the optimal way.
Update : Untitled (codepen.io)
update in other data properties like ‘visible’ are also not reflecting when svg rendering is enabled
Although I can’t really answer this question, I should ask whether you are using the latest version of GoJS (3.0.12 at this moment).
Hello,
There were two bugs here, one with toggling part visibility such that it becomes zero-sized, and one with updating the (undocumented) filter
property. Both have been fixed for 3.0.13, which we will probably release next week. Thank you for reporting with a reproducible case.
In the meantime you could try a workaround like:
myDiagram.model.commit((m) => {
node = myDiagram.findNodeForKey("Alpha");
m.setDataProperty(node.data, "disabled", !node.data.disabled);
// Hacky workaround, this should be removed after upgrading to 3.0.13:
node.svg.remove();
node.svg = null;
}, "change selected node data");
Or just rebuildParts, as you might have been using.
Thank you @simon.
I have reported bugs regarding just 2 properties here. Can you please verify that this’s not the case with other properties.
@simon Here I am adding an Adornment to node. Untitled (codepen.io)
This code is working as expected with svg renderer but same code isn’t working with default renderer!
Can you please check.
This is actually another bug with the SVG context. Add:
hoverAdornmnet.position = new go.Point(0, 0);
And it will work. The new adornment’s position
and location
are both NaN
, so it should not be drawn. However it’s added to the SVG scene, which is a mistake. (it so happens, at (0,0)
)
The other two bugs you found were unrelated. One is that we were not updating the undocumented filter
properly. And the visibility toggle bug was because it happened to make the node zero-sized, which we were not updating properly - it became a drawing no-op too soon to remove the old SVG.
Try the just-released GoJS 3.0.13.