Hi,
I am trying to implement send to back and bring to front functionality. While the below code works fine for bring to front, but has some issues with send to back. For instance i have 2 shapes, and i give go to back command for the top shape and it goes back without any issue. Now the new object which is in front doesnt respond to go to back. Kindly guide me.
function makeContextMenu(wiDiagram)
{
var $ = go.GraphObject.make
return $(go.Adornment, “Vertical”,
$(“ContextMenuButton”,
$(go.TextBlock, “Bring to front”),
{
click: function (e, obj)
{
Your code does put the second node in the “Background” layer, but because the first node is also in the “Background” layer, the second node happens to be in front of the first node.
Instead of using layers, use Part | GoJS API. Note that this assumes that all Nodes are in the same Layer.
Hi Walter
$(“ContextMenuButton”,
$(go.TextBlock, “Send to Back”),
{
click: function (e, obj) {
obj.part.adornedPart.data.zOrder = (obj.part.adornedPart.data.zOrder || 0) + 1;
The above code sets the zOrder but it doesnt reflects in the output.