MCPcopy
hub / github.com/tldraw/tldraw / getVelocityAfterMoving

Function getVelocityAfterMoving

packages/tldraw/src/test/Editor.test.tsx:330–341  ·  view source on GitHub ↗
(elapsed: number, frameCount: number)

Source from the content-addressed store, hash-verified

328
329 it('smooths pointer velocity consistently across frame rates', () => {
330 const getVelocityAfterMoving = (elapsed: number, frameCount: number) => {
331 const testEditor = new TestEditor({})
332 try {
333 for (let i = 1; i <= frameCount; i++) {
334 testEditor.pointerMove((10 * i) / frameCount, (10 * i) / frameCount)
335 testEditor.inputs.updatePointerVelocity(elapsed)
336 }
337 return testEditor.inputs.getPointerVelocity().toJson()
338 } finally {
339 testEditor.dispose()
340 }
341 }
342
343 expect(getVelocityAfterMoving(16, 1)).toCloselyMatchObject({
344 x: 0.3125,

Callers 1

Editor.test.tsxFile · 0.85

Calls 5

pointerMoveMethod · 0.95
updatePointerVelocityMethod · 0.80
getPointerVelocityMethod · 0.80
toJsonMethod · 0.45
disposeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…