Improved click behavior
This commit is contained in:
parent
14f2c2fbe6
commit
6392e4b13a
21
dist/iwmlib.js
vendored
21
dist/iwmlib.js
vendored
@ -5424,19 +5424,22 @@
|
||||
onTap(event, interaction, point) {
|
||||
|
||||
if (this.clickOnTap) {
|
||||
let directNode = document.elementFromPoint(point.x, point.y);
|
||||
let nearestNode = this.nearestClickable(event);
|
||||
|
||||
console.log("onTap", directNode, nearestNode.tagName);
|
||||
if (directNode != null && this.isClickable(directNode)) {
|
||||
let directNode = document.elementFromPoint(event.clientX, event.clientY);
|
||||
console.log("onTap", directNode, this.isClickable(directNode));
|
||||
if (this.isClickable(directNode)) {
|
||||
directNode.click();
|
||||
}
|
||||
else {
|
||||
if (nearestNode.tagName == 'svg' && this.isClickable(nearestNode)) {
|
||||
let nearestNode = this.nearestClickable(event);
|
||||
if (this.isClickable(nearestNode)) {
|
||||
|
||||
if (nearestNode.tagName == 'svg') {
|
||||
let handler = this.tapNodes.get(nearestNode);
|
||||
console.log("Clicking beneath SVG: to be done", handler);
|
||||
Events.stop(event);
|
||||
//nearestNode.click()
|
||||
return
|
||||
}
|
||||
nearestNode.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5463,8 +5466,12 @@
|
||||
}
|
||||
|
||||
isClickable(node) {
|
||||
if (node == null)
|
||||
return false
|
||||
if (node.tagName == 'A')
|
||||
return true
|
||||
if (node.hasAttribute("onclick"))
|
||||
return true
|
||||
if (this.tapNodes.has(node))
|
||||
return true
|
||||
return false
|
||||
|
25
dist/iwmlib.pixi.js
vendored
25
dist/iwmlib.pixi.js
vendored
@ -7189,19 +7189,22 @@
|
||||
onTap(event, interaction, point) {
|
||||
|
||||
if (this.clickOnTap) {
|
||||
let directNode = document.elementFromPoint(point.x, point.y);
|
||||
let nearestNode = this.nearestClickable(event);
|
||||
|
||||
console.log("onTap", directNode, nearestNode.tagName);
|
||||
if (directNode != null && this.isClickable(directNode)) {
|
||||
let directNode = document.elementFromPoint(event.clientX, event.clientY);
|
||||
console.log("onTap", directNode, this.isClickable(directNode));
|
||||
if (this.isClickable(directNode)) {
|
||||
directNode.click();
|
||||
}
|
||||
else {
|
||||
if (nearestNode.tagName == 'svg' && this.isClickable(nearestNode)) {
|
||||
let nearestNode = this.nearestClickable(event);
|
||||
if (this.isClickable(nearestNode)) {
|
||||
|
||||
if (nearestNode.tagName == 'svg') {
|
||||
let handler = this.tapNodes.get(nearestNode);
|
||||
console.log("Clicking beneath SVG: to be done", handler);
|
||||
Events$1.stop(event);
|
||||
//nearestNode.click()
|
||||
return
|
||||
}
|
||||
nearestNode.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7228,8 +7231,12 @@
|
||||
}
|
||||
|
||||
isClickable(node) {
|
||||
if (node == null)
|
||||
return false
|
||||
if (node.tagName == 'A')
|
||||
return true
|
||||
if (node.hasAttribute("onclick"))
|
||||
return true
|
||||
if (this.tapNodes.has(node))
|
||||
return true
|
||||
return false
|
||||
@ -14833,7 +14840,7 @@
|
||||
* @extends Popup
|
||||
* @see {@link https://www.iwm-tuebingen.de/iwmbrowser/lib/pixi/popupmenu.html|DocTest}
|
||||
*/
|
||||
class PopupMenu$1 extends Popup {
|
||||
class PopupMenu extends Popup {
|
||||
|
||||
/**
|
||||
* Creates an instance of a PopupMenu.
|
||||
@ -15482,7 +15489,7 @@
|
||||
window.Stylus = Stylus;
|
||||
window.Switch = Switch;
|
||||
window.Popup = Popup;
|
||||
window.PopupMenu = PopupMenu$1;
|
||||
window.PopupMenu = PopupMenu;
|
||||
window.Modal = Modal;
|
||||
window.Volatile = Volatile;
|
||||
window.Message = Message;
|
||||
|
@ -1304,19 +1304,22 @@ export class DOMScatter extends AbstractScatter {
|
||||
onTap(event, interaction, point) {
|
||||
|
||||
if (this.clickOnTap) {
|
||||
let directNode = document.elementFromPoint(point.x, point.y)
|
||||
let nearestNode = this.nearestClickable(event)
|
||||
|
||||
console.log("onTap", directNode, nearestNode.tagName)
|
||||
if (directNode != null && this.isClickable(directNode)) {
|
||||
let directNode = document.elementFromPoint(event.clientX, event.clientY)
|
||||
console.log("onTap", directNode, this.isClickable(directNode))
|
||||
if (this.isClickable(directNode)) {
|
||||
directNode.click()
|
||||
}
|
||||
else {
|
||||
if (nearestNode.tagName == 'svg' && this.isClickable(nearestNode)) {
|
||||
let nearestNode = this.nearestClickable(event)
|
||||
if (this.isClickable(nearestNode)) {
|
||||
|
||||
if (nearestNode.tagName == 'svg') {
|
||||
let handler = this.tapNodes.get(nearestNode)
|
||||
console.log("Clicking beneath SVG: to be done", handler)
|
||||
Events.stop(event)
|
||||
//nearestNode.click()
|
||||
return
|
||||
}
|
||||
nearestNode.click()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1343,8 +1346,12 @@ export class DOMScatter extends AbstractScatter {
|
||||
}
|
||||
|
||||
isClickable(node) {
|
||||
if (node == null)
|
||||
return false
|
||||
if (node.tagName == 'A')
|
||||
return true
|
||||
if (node.hasAttribute("onclick"))
|
||||
return true
|
||||
if (this.tapNodes.has(node))
|
||||
return true
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user