From 03521796ef8300e4a34d6cf403b31a194dd6440c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 1 Mar 2013 20:25:09 -0800 Subject: [PATCH] Setting Path#selected to false should deselect all handles too. --- src/path/Path.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/path/Path.js b/src/path/Path.js index b61adf21..d593081c 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -754,14 +754,28 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ }, setFullySelected: function(selected) { + // No need to call _selectSegments() when selected is false, since + // #setSelected() does that for us + if (selected) + this._selectSegments(true); + this.setSelected(selected); + }, + + setSelected: function(selected) { + // Deselect all segments when path is marked as not selected + if (!selected) + this._selectSegments(false); + // No need to pass true for noChildren since Path has none anyway. + this.base(selected); + }, + + _selectSegments: function(selected) { var length = this._segments.length; this._selectedSegmentState = selected ? length * /*#=*/ SelectionState.POINT : 0; for (var i = 0; i < length; i++) this._segments[i]._selectionState = selected ? /*#=*/ SelectionState.POINT : 0; - // No need to pass true for noChildren since Path has none anyway. - this.setSelected(selected); }, _updateSelection: function(segment, oldState, newState) {