const newscale = diagram.scale;
diagram.commit((d) => {
(node) => {
// ignore regular nodes
if (!node.data?.viewSpot) return;
// assume that Node.locationSpot == Spot.parse(spotstr)
// now compute the point in document coords of that spot in the viewport
const loc = new go.Point().setRectSpot(
d.viewportBounds,
node.locationSpot
);
// and set the node's location, whose locationSpot is already set appropriately
node.location = loc;
node.scale = 1 / newscale;
node.adornments.each((a) => {
a.scale = 1 / newscale;
});
}
);
}, null)
Above is a snippet of ViewportBoundsChanged.
Fixed Nodes, i.e. nodes with viewSpot property should not scale and are fixed to location in the canvas. The above code works fine for the node, but the adornment changes position on scaling.
Below is what happens when i scale the nodes,