dom-helpers.ts
Home
/
outputframe-app /
injects /
dom-helpers.ts
import { RenderCanvas } from "../elements/render-canvas/render-canvas";
export function clear() {
}
export function rect(x: number, y: number, width: number, height: number): void {
var renderCanvas = <RenderCanvas>document.getElementsByTagName("render-canvas")[0];
renderCanvas.drawRect(x, y, width, height);
}
export function getWidth(): number {
var renderCanvas = <RenderCanvas>document.getElementsByTagName("render-canvas")[0];
return renderCanvas.units.width;
}
export function getHeight(): number {
var renderCanvas = <RenderCanvas>document.getElementsByTagName("render-canvas")[0];
return renderCanvas.units.heigt;
}
export function getCenter(): number {
var renderCanvas = <RenderCanvas>document.getElementsByTagName("render-canvas")[0];
return renderCanvas.units.heigt / 2;
}
export function getRandom(min: number, max: number): number {
return Math.floor(Math.random() * (max - min + 1) + min);
}