Added flag to enable tap clicks for SVG in tested circumstances.
This commit is contained in:
+8
-3
@@ -1044,6 +1044,7 @@ export class DOMScatter extends AbstractScatter {
|
||||
height = null, // required
|
||||
resizable = false,
|
||||
clickOnTap = false,
|
||||
triggerSVGClicks = false,
|
||||
allowClickDistance = 44,
|
||||
verbose = true,
|
||||
onResize = null,
|
||||
@@ -1096,6 +1097,7 @@ export class DOMScatter extends AbstractScatter {
|
||||
this.throwVisibility = Math.min(width, height, throwVisibility)
|
||||
this.container = container
|
||||
this.clickOnTap = clickOnTap
|
||||
this.triggerSVGClicks = triggerSVGClicks
|
||||
this.scale = startScale
|
||||
this.rotationDegrees = this.startRotationDegrees
|
||||
this.transformOrigin = transformOrigin
|
||||
@@ -1152,9 +1154,11 @@ export class DOMScatter extends AbstractScatter {
|
||||
Therefore we make an exception and let the original click event through.
|
||||
*/
|
||||
if (event.target.ownerSVGElement) {
|
||||
return
|
||||
if (this.triggerSVGClicks) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (event.isTrusted) {
|
||||
else if (event.isTrusted) {
|
||||
Events.stop(event)
|
||||
}
|
||||
}, true)
|
||||
@@ -1336,7 +1340,8 @@ export class DOMScatter extends AbstractScatter {
|
||||
if (nearestNode.tagName == 'svg') {
|
||||
let handler = this.tapNodes.get(nearestNode)
|
||||
console.log("Clicking beneath SVG: to be done", handler)
|
||||
// nearestNode.dispatchEvent(new Event('click'))
|
||||
if (this.triggerSVGClicks)
|
||||
nearestNode.dispatchEvent(new Event('click'))
|
||||
return
|
||||
}
|
||||
console.log("nearestNode clicked")
|
||||
|
||||
Reference in New Issue
Block a user