Skip to content

Commit

Permalink
Add early escape when selecting the same component
Browse files Browse the repository at this point in the history
Change-Id: I2fca8de2941613c938eaa0e9be0d391fa67c48f5
  • Loading branch information
ewpatton authored and jisqyv committed Dec 10, 2019
1 parent a04aed3 commit 17ce052
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,11 @@ public final void setSelectedComponent(MockComponent newSelectedComponent) {
YaFormEditor formEditor = (YaFormEditor) editor;
boolean shouldSelectMultipleComponents = formEditor.getShouldSelectMultipleComponents();
List<MockComponent> selectedComponents = formEditor.getSelectedComponents();
if (selectedComponents.size() == 1 && selectedComponents.contains(newSelectedComponent)) {
// Attempting to change the selection from old to new when they are the same breaks
// Marker drag. See https://github.com/mit-cml/appinventor-sources/issues/1936
return;
}
if (shouldSelectMultipleComponents && selectedComponents.size() > 1 && formEditor.isSelectedComponent(newSelectedComponent)) {
int index = selectedComponents.indexOf(newSelectedComponent);
selectedComponent = selectedComponents.get((index == 0) ? 1 : index - 1);
Expand Down

0 comments on commit 17ce052

Please sign in to comment.