MCPcopy
hub / github.com/tldraw/tldraw / rotateX

Function rotateX

packages/tldraw/src/test/resizing.test.ts:2396–2409  ·  view source on GitHub ↗
(times: number)

Source from the content-addressed store, hash-verified

2394 })
2395
2396 function rotateX(times: number) {
2397 editor.select(ids.boxX)
2398 // Rotate boxX in 90deg steps around its center, equivalent to the
2399 // original interactive rotation from the top-left rotate handle.
2400 editor.rotateShapesBy([ids.boxX], (PI / 2) * times)
2401
2402 expect(editor.getShapePageBounds(ids.boxX)!.x).toBeCloseTo(40)
2403 expect(editor.getShapePageBounds(ids.boxX)!.y).toBeCloseTo(40)
2404 expect(editor.getShapePageBounds(ids.boxX)!.w).toBeCloseTo(60)
2405 expect(editor.getShapePageBounds(ids.boxX)!.h).toBeCloseTo(60)
2406 expect(editor.getShape(ids.boxX)!.rotation).toEqual(
2407 canonicalizeRotation(((PI / 2) * times) % (PI * 2))
2408 )
2409 }
2410
2411 it('should work for 90deg', () => {
2412 rotateX(1)

Callers 1

resizing.test.tsFile · 0.85

Calls 5

canonicalizeRotationFunction · 0.90
selectMethod · 0.80
rotateShapesByMethod · 0.80
getShapePageBoundsMethod · 0.80
getShapeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…