@esneiderbravo/speclaw 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -193,7 +193,7 @@ function draw(){
|
|
|
193
193
|
}
|
|
194
194
|
ctx.globalAlpha=1;
|
|
195
195
|
}
|
|
196
|
-
function loop(){ tick(); draw(); requestAnimationFrame(loop); }
|
|
196
|
+
function loop(){ tick(); draw(); requestAnimationFrame(loop); }
|
|
197
197
|
|
|
198
198
|
// interaction
|
|
199
199
|
let dragging=null, panning=false, lastX=0, lastY=0;
|
|
@@ -214,5 +214,7 @@ addEventListener('mousemove', e=>{
|
|
|
214
214
|
addEventListener('mouseup', ()=>{ dragging=null; panning=false; });
|
|
215
215
|
cv.addEventListener('wheel', e=>{ e.preventDefault(); const f=e.deltaY<0?1.1:0.9;
|
|
216
216
|
const mx=e.clientX, my=e.clientY; ox=mx-(mx-ox)*f; oy=my-(my-oy)*f; scale*=f; }, {passive:false});
|
|
217
|
+
|
|
218
|
+
loop(); // start once every declaration above is initialized (avoids the TDZ on 'dragging')
|
|
217
219
|
</script></body></html>`;
|
|
218
220
|
}
|