ammap3
ammap3 copied to clipboard
OnBackgroundClicked
Is there a good solution to figure out that the map-background has clicked?
solved the problem:
map.background.click(() => {
// do something
});
haven't found it, because i looked for events or handlers in the doku.
EDIT: It doesn't work in Chrome
I'd probably still go with build in events. If you need to specifically catch click on non-object, you might combine click
and clickMapObject
events.
Something like this:
"listeners": [{
"event": "click",
"method": function(ev) {
ev.chart.clickTimeout = setTimeout(function () {
console.log("click");
}, 10);
}
}, {
"event": "clickMapObject",
"method": function(ev) {
clearTimeout(ev.chart.clickTimeout);
console.log("clickMapObject")
}
}]
Here's a working demo: https://codepen.io/team/amcharts/pen/60ea204a3b4846c0288d460103601c10?editors=0010
Hope this helps.