changing new shape property sets it as default (#520)

* changing new shape property sets it as default

* set correct opacity while editing new test

Co-authored-by: Christopher Chedeau <vjeuxx@gmail.com>
This commit is contained in:
lissitz 2020-01-25 18:58:57 +01:00 committed by Christopher Chedeau
parent 69061e20ac
commit 1bae203a78
5 changed files with 41 additions and 8 deletions

View file

@ -126,6 +126,10 @@ function pickAppStatePropertiesForHistory(
exportBackground: appState.exportBackground,
currentItemStrokeColor: appState.currentItemStrokeColor,
currentItemBackgroundColor: appState.currentItemBackgroundColor,
currentItemFillStyle: appState.currentItemFillStyle,
currentItemStrokeWidth: appState.currentItemStrokeWidth,
currentItemRoughness: appState.currentItemRoughness,
currentItemOpacity: appState.currentItemOpacity,
currentItemFont: appState.currentItemFont,
viewBackgroundColor: appState.viewBackgroundColor,
name: appState.name,
@ -791,10 +795,10 @@ export class App extends React.Component<any, AppState> {
y,
this.state.currentItemStrokeColor,
this.state.currentItemBackgroundColor,
"hachure",
1,
1,
100,
this.state.currentItemFillStyle,
this.state.currentItemStrokeWidth,
this.state.currentItemRoughness,
this.state.currentItemOpacity,
);
if (isTextElement(element)) {
@ -892,6 +896,7 @@ export class App extends React.Component<any, AppState> {
x: textX,
y: textY,
strokeColor: this.state.currentItemStrokeColor,
opacity: this.state.currentItemOpacity,
font: this.state.currentItemFont,
onSubmit: text => {
if (text) {
@ -1234,10 +1239,10 @@ export class App extends React.Component<any, AppState> {
y,
this.state.currentItemStrokeColor,
this.state.currentItemBackgroundColor,
"hachure",
1,
1,
100,
this.state.currentItemFillStyle,
this.state.currentItemStrokeWidth,
this.state.currentItemRoughness,
this.state.currentItemOpacity,
),
"", // default text
this.state.currentItemFont, // default font
@ -1296,6 +1301,7 @@ export class App extends React.Component<any, AppState> {
y: textY,
strokeColor: element.strokeColor,
font: element.font,
opacity: this.state.currentItemOpacity,
onSubmit: text => {
if (text) {
elements = [