I created Node at TOP RIGHT. But it’s moved when i do zoom out or zoom in.
Here is my code for that node:
var menuTempl =
// $(go.Node, “Auto”, // the Shape will go around the whole table
$(go.Part, {
layerName: “Adornment”,
// selectable: false,
_viewPosition: new go.Point(0,0)
},
$(go.Shape, { strokeWidth: 0 }), // no border
$(go.Panel,
$(go.Shape, { strokeWidth: 1, fill: “white” }), // no border
$(go.Panel, “Table”,
{ padding: 3 },
// the first column has an assortment of CheckBoxes
$(go.Panel, “Vertical”,
{ row: 1, column: 0, defaultAlignment: go.Spot.Left },
$(go.TextBlock, “Display options”, { font: “18pt sans-serif”}),
$(“CheckBox”, “Option1”,
$(go.TextBlock, “Option1”)
),
$(“CheckBox”, “Option1”,
$(go.TextBlock, “Option2”)
),
$(“CheckBox”, “Option1”,
$(go.TextBlock, “Option3”)
),
$(“Button”,
{ margin: 2,
click: displayOption },
$(go.TextBlock, “Apply”))
)
))
// )
);
myDiagram.addDiagramListener(“ViewportBoundsChanged”, function(e) {
var dia = e.diagram; dia.startTransaction("fix Parts"); // only iterates through simple Parts in the diagram, not Nodes or Links dia.parts.each(function(part) { // and only on those that have the "_viewPosition" property set to a Point if (part._viewPosition) { part.position = dia.transformViewToDoc(part._viewPosition); part.scale = 1/dia.scale; } }); dia.commitTransaction("fix Parts");
});