12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { RoughCanvas } from "roughjs/bin/canvas";
- import { SceneState } from "../scene/types";
- import { randomSeed } from "../random";
- export function newElement(
- type: string,
- x: number,
- y: number,
- strokeColor: string,
- backgroundColor: string,
- fillStyle: string,
- strokeWidth: number,
- roughness: number,
- opacity: number,
- width = 0,
- height = 0
- ) {
- const element = {
- type: type,
- x: x,
- y: y,
- width: width,
- height: height,
- isSelected: false,
- strokeColor: strokeColor,
- backgroundColor: backgroundColor,
- fillStyle: fillStyle,
- strokeWidth: strokeWidth,
- roughness: roughness,
- opacity: opacity,
- seed: randomSeed(),
- draw(
- rc: RoughCanvas,
- context: CanvasRenderingContext2D,
- sceneState: SceneState
- ) {}
- };
- return element;
- }
|