Hi.
I am looking for a working example of binding the location of a node with a function in the twoway clause. My case involves using positioning to mimic scaling meaning that every time the node is moved I have to calculate the ‘non-zoomed’ position of the node which I later serialise. Perhaps just go with the idea that I want to fire a function when location changes and modify my model within the function.
This is the way I am thinking.
model = { loc: ‘100 200’, myX: 100, myY: 200 }
… in node template defn…
, new go.Binding("location", "loc", go.Point.parse).makeTwoWay(locChange)
function locChange(loc, data) {
<span =“Apple-tab-span” style=“white-space:pre”> data.myX = loc.x * some_factor
<span =“Apple-tab-span” style=“white-space: pre;”> data.myY = loc.y * some_factor
}