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