excalidraw/src/element/newElement.ts

33 lines
511 B
TypeScript
Raw Normal View History

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,
x,
y,
width,
height,
strokeColor,
backgroundColor,
fillStyle,
strokeWidth,
roughness,
opacity,
isSelected: false,
seed: randomSeed()
};
return element;
}