I want to know click event of panel Expander Button

I want to know which click event is performed on the panel Expander Button. Alternatively, I would like any indication, such as a Boolean flag, to confirm that a click event has been performed.

Panel Code:
$(“PanelExpanderButton”, “COLLAPSIBLE”,
{
row: 0,
scale: 0.80,
column: 1,
alignment: go.Spot.TopRight,
click: FillBrList,
},
new go.Binding(“visible”, “isrulepresent”, setBooleanvalue).makeTwoWay(),
go.GraphObject.make(go.Shape,
{
name: ‘ButtonIcon’,
width: 8,
height: 5,
scale: 0.80,
},
new go.Binding(‘geometryString’, ‘visible’,
(vis) => {
return vis ? ‘F M24.642,18.124l-1.768,1.768L16,13.017,9.124,19.892,7.357,18.124,16,9.481Zm0,0’ : ‘F M24.642,13.874l-1.768-1.768L16,18.981,9.124,12.106,7.357,13.874,16,22.517Zm0,0’
},
// ).ofObject(‘PROPTEXT’)
).ofObject(‘COLLAPSIBLE’)
)
),

I want to know panel Expander Button click event in below listener:
diagram.addDiagramListener(“ObjectSingleClicked”, function (e) {
})

Note: Please use addDiagramListener to identify click event.

I’m not sure exactly what you are trying to achieve, but your suggestion about a boolean flag is interesting.

In fact, if you look at the implementation of the “PanelExpanderButton” in extensionsJSM/Buttons.ts (or the .js file extensions/Buttons..js) you will see that it executes toggling the GraphObject.visible property of the named Panel. So there’s the boolean property that you seek. If you wanted to have that boolean property be on the node’s data object in the model, just add a TwoWay Binding on that “visible” property.

But if you are looking for some other functionality, please describe what you want more fully.

In simple terms, I want to know if a click event on the PanelExpanderButton was performed using addDiagramListener .
Note : My goal is to determine which part of the node was clicked.

diagram.addDiagramListener (“ObjectSingleClicked”, function (e) {
})

OK, so it sounds as if just knowing (or perhaps wanting to save) the collapsed/expanded state of the GraphObject whose GraphObject.visible property is being toggled is not what you actually want to know.

Are you saying that you care where in the “PanelExpanderButton” the user clicked? Or do you have more than one “PanelExpanderButton” in each Node and you want to know which one they called? If the latter, do the two (or more?) "PanelExpanderButton"s expand/collapse the same GraphObject? Otherwise I don’t see why you would care.

If you want to know which part of the node was clicked, you can look at the InputEvent of a GraphObject.click event or in an “ObjectSingleClicked” DiagramEvent listener you can get the Diagram.lastInput. Once you have that most recent InputEvent, the InputEvent.documentPoint will tell you in document coordinates where the InputEvent happened, and you can compare that with either your Node’s actualBounds or, for any GraphObject within the visual tree of your Node, call GraphObject.getDocumentBounds or GraphObject.getDocumentPoint.