import analyser and migrate to solidjs, untested

This commit is contained in:
Robin Appelman 2023-04-22 15:54:14 +02:00
commit fff554c3d3
42 changed files with 2910 additions and 4 deletions

View file

@ -0,0 +1,36 @@
export interface ViewPortOptions {
x?: number;
y?: number;
width: number;
height: number;
}
export interface Point {
x: number;
y: number;
}
export class Viewport {
x: number;
y: number;
width: number;
height: number;
constructor(options: ViewPortOptions) {
this.x = options.x || 0;
this.y = options.y || 0;
this.width = options.width;
this.height = options.height;
}
static convert(point: Point, {from, to}: {from: Viewport, to: Viewport}): Point {
const widthScale = from.width / to.width;
const heightScale = from.height / to.height;
return {
x: point.x * widthScale - to.x * widthScale,
y: point.y * heightScale - to.y * heightScale
};
}
}