mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Refactor Element Functions (#233)
* Remove `generatedraw` from element object - Create a function that renders a single element - Refactor rendering selected elements * Replace getElementAbsoluteXY with getElementAbsoluteCoords
This commit is contained in:
parent
85365e5bcb
commit
829a65b8cb
14 changed files with 206 additions and 184 deletions
|
@ -1,6 +1,3 @@
|
|||
import { RoughCanvas } from "roughjs/bin/canvas";
|
||||
|
||||
import { SceneState } from "../scene/types";
|
||||
import { randomSeed } from "../random";
|
||||
|
||||
export function newElement(
|
||||
|
@ -17,24 +14,19 @@ export function newElement(
|
|||
height = 0
|
||||
) {
|
||||
const element = {
|
||||
type: type,
|
||||
x: x,
|
||||
y: y,
|
||||
width: width,
|
||||
height: height,
|
||||
type,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
strokeColor,
|
||||
backgroundColor,
|
||||
fillStyle,
|
||||
strokeWidth,
|
||||
roughness,
|
||||
opacity,
|
||||
isSelected: false,
|
||||
strokeColor: strokeColor,
|
||||
backgroundColor: backgroundColor,
|
||||
fillStyle: fillStyle,
|
||||
strokeWidth: strokeWidth,
|
||||
roughness: roughness,
|
||||
opacity: opacity,
|
||||
seed: randomSeed(),
|
||||
draw(
|
||||
rc: RoughCanvas,
|
||||
context: CanvasRenderingContext2D,
|
||||
sceneState: SceneState
|
||||
) {}
|
||||
seed: randomSeed()
|
||||
};
|
||||
return element;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue