| 74 | const thumbDisplayed = {}; |
| 75 | |
| 76 | async function handler(label) { |
| 77 | mouseDown = true; |
| 78 | const className = CONTROLS[label]; |
| 79 | const button = document.getElementById(className); |
| 80 | const total = document.getElementById(className + '-total'); |
| 81 | while (mouseDown) { |
| 82 | addExampleHandler(label); |
| 83 | document.body.setAttribute('data-active', CONTROLS[label]); |
| 84 | total.innerText = ++totals[label]; |
| 85 | await tf.nextFrame(); |
| 86 | } |
| 87 | document.body.removeAttribute('data-active'); |
| 88 | } |
| 89 | |
| 90 | upButton.addEventListener('mousedown', () => handler(0)); |
| 91 | upButton.addEventListener('mouseup', () => mouseDown = false); |