Improved click behavior

This commit is contained in:
Uwe Oestermeier 2019-07-05 14:40:35 +02:00
parent 14f2c2fbe6
commit 6392e4b13a
3 changed files with 44 additions and 23 deletions

21
dist/iwmlib.js vendored
View File

@ -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
View File

@ -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;

View File

@ -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