mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
* Remove `generatedraw` from element object - Create a function that renders a single element - Refactor rendering selected elements * Replace getElementAbsoluteXY with getElementAbsoluteCoords
32 lines
511 B
TypeScript
32 lines
511 B
TypeScript
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;
|
|
}
|