Hello everybody
ref version 2.0
when I set the resizable property of a selected node to false, the adornment doesn’t change and the node is still resizable .
Kind regards
axel
Hello everybody
ref version 2.0
when I set the resizable property of a selected node to false, the adornment doesn’t change and the node is still resizable .
Kind regards
axel
Are you making changes within a transaction?
var node = . . .
node.diagram.commit(function(d) {
node.resizable = !node.resizable;
}, "toggled resizable");
When I try this, I the Adornments seem to update correctly.
I use bindings to toggle between resize and reshape.
This code works in 1.8.21
new go.Binding("resizable", "", function (data, node) {
return data.edit == "resize" ? true : false;
}),
new go.Binding("reshapable", "", function (data, node) {
return data.edit == "reshape" ? true : false;
}),
Your binding could be more efficiently implemented as:
new go.Binding("resizable", "edit", function(edit) { return edit === "resize"; })
Here’s what I just tried in both 1.8.21 and 2.0.3:
myDiagram.nodeTemplate =
$(go.Node, "Auto",
new go.Binding("resizable"),
. . . );
function test() {
var node = myDiagram.selection.first();
if (node instanceof go.Node) {
myDiagram.model.commit(function(m) {
m.set(node.data, "resizable", !node.data.resizable);
}, "toggle resizable");
}
}
<button onclick="test()">Test</button>
After selecting a node, clicking the “Test” button correctly updates the node’s adornments each time.
I found out that it is a bug in 2.0.0.
2.0.3 works as expected.
Thanks for your help…