(target, handler)
| 465 | |
| 466 | // Handle clicks, but only if the mouse did not move during the click. |
| 467 | function onClick(target, handler) { |
| 468 | // Disable click if mouse moves more than threshold pixels since mousedown. |
| 469 | const threshold = 3; |
| 470 | let [x, y] = [-1, -1]; |
| 471 | target.addEventListener('mousedown', (e) => { |
| 472 | [x, y] = [e.clientX, e.clientY]; |
| 473 | }); |
| 474 | target.addEventListener('click', (e) => { |
| 475 | if (Math.abs(e.clientX - x) <= threshold && |
| 476 | Math.abs(e.clientY - y) <= threshold) { |
| 477 | handler(); |
| 478 | } |
| 479 | }); |
| 480 | } |
| 481 | |
| 482 | function drawSep(y, posTotal, negTotal) { |
| 483 | const m = document.createElement('div'); |
no outgoing calls
no test coverage detected
searching dependent graphs…