(e, layerdict)
| 826 | } |
| 827 | |
| 828 | function handleMouseClick(e, layerdict) { |
| 829 | if (!e.hasOwnProperty("offsetX")) { |
| 830 | // The polyfill doesn't set this properly |
| 831 | e.offsetX = e.pageX - e.currentTarget.offsetLeft; |
| 832 | e.offsetY = e.pageY - e.currentTarget.offsetTop; |
| 833 | } |
| 834 | |
| 835 | var x = e.offsetX; |
| 836 | var y = e.offsetY; |
| 837 | var t = layerdict.transform; |
| 838 | var flip = layerdict.layer === "B"; |
| 839 | if (flip) { |
| 840 | x = (devicePixelRatio * x / t.zoom - t.panx + t.x) / -t.s; |
| 841 | } else { |
| 842 | x = (devicePixelRatio * x / t.zoom - t.panx - t.x) / t.s; |
| 843 | } |
| 844 | y = (devicePixelRatio * y / t.zoom - t.y - t.pany) / t.s; |
| 845 | var v = rotateVector([x, y], -settings.boardRotation + (flip && settings.offsetBackRotation ? - 180 : 0)); |
| 846 | if ("nets" in pcbdata) { |
| 847 | var net = netHitScan(layerdict.layer, ...v); |
| 848 | if (net !== highlightedNet) { |
| 849 | netClicked(net); |
| 850 | } |
| 851 | } |
| 852 | if (highlightedNet === null) { |
| 853 | var footprints = bboxHitScan(layerdict.layer, ...v); |
| 854 | if (footprints.length > 0) { |
| 855 | footprintsClicked(footprints); |
| 856 | } |
| 857 | } |
| 858 | } |
| 859 | |
| 860 | function handlePointerLeave(e, layerdict) { |
| 861 | e.preventDefault(); |
no test coverage detected