Changed wrapper and events to allow other EventListeners.
This commit is contained in:
		
							parent
							
								
									fa0256d782
								
							
						
					
					
						commit
						ca5a39d661
					
				| @ -54,7 +54,7 @@ export default class CardWrapper extends Object { | ||||
| 
 | ||||
|     isClickable(node) { | ||||
|         if (node == null) return false | ||||
|             //  console.log("isClickable", node, this.isClickPrevented(node))
 | ||||
|         //  console.log("isClickable", node, this.isClickPrevented(node))
 | ||||
|         if (this.isClickPrevented(node)) { | ||||
|             return false | ||||
|         } | ||||
| @ -101,8 +101,8 @@ export default class CardWrapper extends Object { | ||||
| 
 | ||||
|         let clickRects = activeNodes.map(link => { | ||||
|             let rect = link.getBoundingClientRect() | ||||
|                 // Since the getBoundingClientRect is untransformed we cannot rely on it's size
 | ||||
|                 // We need a transformed bottom right to calculate local width and height
 | ||||
|             // Since the getBoundingClientRect is untransformed we cannot rely on it's size
 | ||||
|             // We need a transformed bottom right to calculate local width and height
 | ||||
|             let bottomRight = Points.fromPageToNode(element, { | ||||
|                 x: rect.x + rect.width, | ||||
|                 y: rect.y + rect.height | ||||
| @ -146,14 +146,19 @@ export default class CardWrapper extends Object { | ||||
|         /* https://stackoverflow.com/questions/49564905/is-it-possible-to-use-click-function-on-svg-tags-i-tried-element-click-on-a | ||||
|          proposes the dispatchEvent solution. But this leads to problems in flippable.html hiding the back page. | ||||
|         Therefore we use the original click event (see constructor). */ | ||||
|         if (this.isSVGNode(node)) { | ||||
|             if (this.triggerSVGClicks) { | ||||
|                 let click = new Event('click') | ||||
|                 node.dispatchEvent(click) | ||||
|             } | ||||
|             return | ||||
|         } | ||||
|         node.click() | ||||
|         // if (this.isSVGNode(node)) {
 | ||||
|         //     if (this.triggerSVGClicks) {
 | ||||
|         //         let click = new Event('click')
 | ||||
|         //         node.dispatchEvent(click)
 | ||||
|         //     }
 | ||||
|         //     return
 | ||||
|         // }
 | ||||
|         // node.click()
 | ||||
| 
 | ||||
|         let click = new Event('click') | ||||
|         click.clientX = event.clientX | ||||
|         click.clientY = event.clientY | ||||
|         node.dispatchEvent(click) | ||||
|     } | ||||
| 
 | ||||
|     nodeTapped(node, event) { | ||||
| @ -200,4 +205,4 @@ export default class CardWrapper extends Object { | ||||
|             this.tapNodes.set(objOrSelector, handler) | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
|  | ||||
| @ -1,7 +1,10 @@ | ||||
| export default class Events { | ||||
|     static stop(event) { | ||||
|         event.preventDefault() | ||||
|         event.stopPropagation() | ||||
|         // I removed this, as it destroys all the Hammer.js events.
 | ||||
|         // And also the click event. 
 | ||||
|         // It seems to have no (apparent) negative impact. -SO
 | ||||
|         // event.stopPropagation()
 | ||||
|     } | ||||
| 
 | ||||
|     static extractPoint(event) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user