From 4c1bf07863f9b0106936569aad5301aedaa7a7f5 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Thu, 2 Jan 2020 22:03:14 +0100 Subject: [PATCH] ensure click-to-select is exclusive (fixes #43) (#45) --- src/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index e6492a68..82db6097 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -450,10 +450,13 @@ class App extends React.Component<{}, AppState> { return isSelected; }); + // deselect everything except target element to-be-selected + elements.forEach(element => { + if (element === selectedElement) return; + element.isSelected = false; + }); if (selectedElement) { this.setState({ draggingElement: selectedElement }); - } else { - clearSelection(); } isDraggingElements = elements.some(