Skip to content

Commit

Permalink
Only permit deletion when not being dragged, see #414
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Oct 17, 2017
1 parent a09262c commit 7680d9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion js/view/CircuitElementNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ define( function( require ) {
// prevent default so 'backspace' and 'delete' don't navigate back a page in Firefox, see
// https://github.com/phetsims/circuit-construction-kit-common/issues/307
event.preventDefault();
circuit.circuitElements.remove( circuitElement );

// Only permit deletion when not being dragged, see https://github.com/phetsims/circuit-construction-kit-common/issues/414
if ( !circuitElement.startVertexProperty.value.isDragged && !circuitElement.endVertexProperty.value.isDragged ) {
circuit.circuitElements.remove( circuitElement );
}
}
}
} );
Expand Down
6 changes: 5 additions & 1 deletion js/view/TrashButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ define( function( require ) {
scale: CCKCConstants.FONT_AWESOME_ICON_SCALE
} ),
listener: function() {
circuit.circuitElements.remove( circuitElement );

// Only permit deletion when not being dragged, see https://github.com/phetsims/circuit-construction-kit-common/issues/414
if ( !circuitElement.startVertexProperty.value.isDragged && !circuitElement.endVertexProperty.value.isDragged ) {
circuit.circuitElements.remove( circuitElement );
}
},
minXMargin: 10,
minYMargin: 10,
Expand Down

0 comments on commit 7680d9d

Please sign in to comment.