When a node is selected, just like the org sample, we have a object properties viewer (in html/angular).
A user can make changes to properties causing validation errors. While in error we want to deny certain actions on the graph:
deny selection changing
deny deletion (i believe i can use ‘canDeleteSelection’)
I cannot seem to find a way to cancel selection changing.
Is there another option apart from Diagram.allowSelect?
This works fine, but not very clear to the user why he cant click on stuff.
I would rather that when he clicks to select - i give me a message telling him errors and in the same instance stop his selection.
really back to - is there a way to cancel the selection changing?
Well, for simple clicks and rubber-band drags you could override the Tool.standardMouseSelect method of the ClickSelectingTool to do what you want.
However there are other tools that can select or de-select, so those would all have to put up a message and be disabled too. Those include the DraggingTool and LinkingTool and ContextMenuTool and perhaps others. So that would be a lot of tools that would need method overriding (or simple disablement by setting Tool.isEnabled to false). https://gojs.net/latest/intro/tools.html
Furthermore the CommandHandler.selectAll command would still work, so you would need to override CommandHandler.doKeyDown in order to make Ctrl/Cmd-A put up a message and be a no-op. https://gojs.net/latest/intro/commands.html#CommandHandler