Hi,
I have a binding on a vertical panel as follows:
$(go.Panel, 'Vertical',
{
row: 2, column: 1, name: 'PROPTEXT',
width: 205,
margin: new go.Margin(-1, -1.5, 0, 35)
},
new go.Binding('visible', '', (data) => {
return this.qViewVisible;
}),
Where qViewVisible is a boolean flag that can be set by the user in a different menu.
I also have a panelExpander button to control the visibility of this panel on each node. Refer below:
$("PanelExpanderButton", "PROPTEXT",
{
row: 2, column: 2,
margin: new go.Margin(0, 0, 10, 0),
'ButtonBorder.fill': 'white', '_buttonFillOver': 'white',
'_buttonStrokeOver': 'white',
cursor: 'pointer',
click: (e, btn) => {
var diagram = btn.diagram;
if (diagram === null) return;
if (diagram.isReadOnly) return;
var elt = btn.findTemplateBinder();
if (elt === null) elt = btn.part;
if (elt !== null) {
var pan = elt.findObject('PROPTEXT');
if (pan !== null) {
diagram.startTransaction('Collapse/Expand Panel');
pan.visible = !pan.visible;
diagram.commitTransaction('Collapse/Expand Panel');
}
}
e.handled = true;
},
background: 'white'
},
go.GraphObject.make(go.Shape,
{
name: 'ButtonIcon',
fill: '#10069f',
stroke: '#10069F',
strokeWidth: 1,
width: 10,
height: 7,
background: 'white',
},
new go.Binding('geometryString', 'visible',
(vis) => { return vis ? 'F M24.642,18.124l-1.768,1.768L16,13.017,9.124,19.892,7.357,18.124,16,9.481Zm0,0' : 'F M24.642,13.874l-1.768-1.768L16,18.981,9.124,12.106,7.357,13.874,16,22.517Zm0,0' }
).ofObject('PROPTEXT')
)
),
Scenario:
- I have a diagram with 4 nodes in it. PROPTEXT panels of all 4 nodes are initially not visible.
- I click on the panelExpander button for node 3, which expands the PROPTEXT panel only for that node
- Now i move node 3 a bit on the diagram canvas, Using the debugger tools i see that the Binding on the visible property is triggered for all the nodes on the canvas, and resets it to the value of qViewVisible. This now results in closure of the panel for node 3 just because the node was moved on the canvas
How can i prevent this behaviour? I dont want to reset the binding on the visible property just on moving the node.