From afe6331c61faf820332948b0dd785539c3e2175c Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Wed, 1 Jan 2020 22:09:12 -0800 Subject: [PATCH] Reset selection when adding text --- src/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index d4abc7ef..9761811b 100644 --- a/src/index.js +++ b/src/index.js @@ -257,7 +257,10 @@ class App extends React.Component { generateDraw(element); elements.push(element); if (this.state.elementType === "text") { - this.setState({ draggingElement: null }); + this.setState({ + draggingElement: null, + elementType: "selection" + }); element.isSelected = true; } else { this.setState({ draggingElement: element }); @@ -297,8 +300,10 @@ class App extends React.Component { } else { draggingElement.isSelected = true; } - this.setState({ draggingElement: null }); - this.setState({ elementType: "selection" }); + this.setState({ + draggingElement: null, + elementType: "selection" + }); drawScene(); };