Hello,
I have a map component with a vector polygon over the map which I want users to click to navigate to a sub map based on the clicked polygon.
I see it’s not possible from designer to attach events directly to sub-objects of the perspective map component so I have created a MouseEvents.onClick script on the map component in which I would like to check the event source and verify whether it was my polygon or another area of the map.
I tried printing the possible fields of the event with:
def runAction(self, event):
log = system.util.logger("MapLogging")
log.error("event.source={}".format(event.source))
log.error("event.target={}".format(event.target))
but neither “source” or “target” keys are defined for the event:
Error running action 'dom.onClick' on components/component-views/display/map@C$0:0/root/FlexContainer/ComponentInstance2/Map: Traceback (most recent call last): File "<function:runAction>", line 11, in runAction AttributeError: 'com.inductiveautomation.ignition.common.script.ada' object has no attribute 'source'
the event object contains only:
{
"type": "click",
"eventPhase": 3,
"bubbles": true,
"cancelable": true,
"timeStamp": 2204.760000007809,
"defaultPrevented": false,
"isTrusted": true,
"detail": 1,
"screenX": 1022,
"screenY": 500,
"clientX": 929,
"clientY": 360,
"pageX": 929,
"pageY": 360,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"button": 0,
"buttons": 0,
"movementX": 0,
"movementY": 0
}
any idea on how to delve deeper on the raised events and in particular the source of an event?