When diagram isReadOnly, disable a shape's 'cursor: "move"'

I dynamically switch from ‘view’ to ‘edit’ modes. Is there a way I can I access the ‘isReadOnly’ value from nested objects in the diagram?

There isn’t any way to have a Binding whose source is the Diagram. (We’ve thought about adding that, but it isn’t very useful; your case is one of the few exceptions.)

But you can have a Binding whose source is a property on the Model.modelData shared data object. So if you don’t mind calling

myDiagram.model.setDataProperty(myDiagram.model.modelData, "isReadOnly", true)

you could have a Binding such as:

  new go.Binding("cursor", "isReadOnly",
                 function(ro) { return ro ? null : "move"; }).ofModel()

Note that this assumes that you have already set { cursor: "move" } as the initial value.

If you don’t want to use a Binding due to overhead, or if you cannot because the logic is more complicated, you can just iterate over the Diagram.nodes (or whatever), call Panel.findObject to find the particular object in the visual tree, and set the GraphObject.cursor programmatically.

That did the trick! Thanks, Walter!