mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Regenerate roughjs shape only when the item is updated (#316)
* Regenerate roughjs shape only when the item is updated * Remove shape object during export and history undo/redo * Remove shape element during copying * Fix shape generation during creation
This commit is contained in:
parent
1bf18fe4ed
commit
74764b06eb
7 changed files with 109 additions and 71 deletions
|
@ -24,6 +24,7 @@ export const actionChangeStrokeColor: Action = {
|
|||
return {
|
||||
elements: changeProperty(elements, el => ({
|
||||
...el,
|
||||
shape: null,
|
||||
strokeColor: value
|
||||
})),
|
||||
appState: { ...appState, currentItemStrokeColor: value }
|
||||
|
@ -50,6 +51,7 @@ export const actionChangeBackgroundColor: Action = {
|
|||
return {
|
||||
elements: changeProperty(elements, el => ({
|
||||
...el,
|
||||
shape: null,
|
||||
backgroundColor: value
|
||||
})),
|
||||
appState: { ...appState, currentItemBackgroundColor: value }
|
||||
|
@ -76,6 +78,7 @@ export const actionChangeFillStyle: Action = {
|
|||
return {
|
||||
elements: changeProperty(elements, el => ({
|
||||
...el,
|
||||
shape: null,
|
||||
fillStyle: value
|
||||
}))
|
||||
};
|
||||
|
@ -104,6 +107,7 @@ export const actionChangeStrokeWidth: Action = {
|
|||
return {
|
||||
elements: changeProperty(elements, el => ({
|
||||
...el,
|
||||
shape: null,
|
||||
strokeWidth: value
|
||||
}))
|
||||
};
|
||||
|
@ -130,6 +134,7 @@ export const actionChangeSloppiness: Action = {
|
|||
return {
|
||||
elements: changeProperty(elements, el => ({
|
||||
...el,
|
||||
shape: null,
|
||||
roughness: value
|
||||
}))
|
||||
};
|
||||
|
@ -156,6 +161,7 @@ export const actionChangeOpacity: Action = {
|
|||
return {
|
||||
elements: changeProperty(elements, el => ({
|
||||
...el,
|
||||
shape: null,
|
||||
opacity: value
|
||||
}))
|
||||
};
|
||||
|
@ -185,6 +191,7 @@ export const actionChangeFontSize: Action = {
|
|||
if (isTextElement(el)) {
|
||||
const element: ExcalidrawTextElement = {
|
||||
...el,
|
||||
shape: null,
|
||||
font: `${value}px ${el.font.split("px ")[1]}`
|
||||
};
|
||||
redrawTextBoundingBox(element);
|
||||
|
@ -223,6 +230,7 @@ export const actionChangeFontFamily: Action = {
|
|||
if (isTextElement(el)) {
|
||||
const element: ExcalidrawTextElement = {
|
||||
...el,
|
||||
shape: null,
|
||||
font: `${el.font.split("px ")[0]}px ${value}`
|
||||
};
|
||||
redrawTextBoundingBox(element);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue