move RotatedDOMRect

This commit is contained in:
Orion Reed 2024-12-02 18:33:07 -05:00
parent 792cf0683a
commit f2383af8ab
2 changed files with 15 additions and 14 deletions

View File

@ -1 +1,15 @@
export type Point = { x: number; y: number };
export type RotatedDOMRect = DOMRect & {
/** in radians */
rotation: number;
/** Returns the center point in worldspace coordinates */
center(): Point;
/** Returns the four corners in worldspace coordinates, in clockwise order */
corners(): [Point, Point, Point, Point];
/** Returns all the vertices in worldspace coordinates */
vertices(): Point[];
};

View File

@ -1,25 +1,12 @@
import { css, html } from './common/tags';
import { ResizeObserverManager } from './common/resize-observer';
import type { Point } from './common/types';
import type { Point, RotatedDOMRect } from './common/types';
import { Vector } from './common/Vector';
const resizeObserver = new ResizeObserverManager();
export type Shape = 'rectangle' | 'circle' | 'triangle';
type RotatedDOMRect = DOMRect & {
/** in radians */
rotation: number;
/** Returns the center point in worldspace coordinates */
center(): Point;
/** Returns the four corners in worldspace coordinates, in clockwise order */
corners(): [Point, Point, Point, Point];
/** Returns all the vertices in worldspace coordinates */
vertices(): Point[];
};
export type MoveEventDetail = { movementX: number; movementY: number };
export class MoveEvent extends CustomEvent<MoveEventDetail> {