Skip to content

Commit

Permalink
Only fire edited event on drag end
Browse files Browse the repository at this point in the history
Instead of firing an edited event whenever a position handle, mid-position
handle or shape has been dragged, wait until the dragging is done to
fire it.
  • Loading branch information
bmcallis committed Feb 3, 2016
1 parent 6e7cc82 commit 9c07a5e
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions DrawHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1292,25 +1292,14 @@ var DrawHelper = (function() {
_self.positions[index] = position;
updateHalfMarkers(index, _self.positions);
_self._createPrimitive = true;

onEdited();
},
onDrag: function(index, position) {
_self.positions[index] = position;
updateHalfMarkers(index, _self.positions);
_self._createPrimitive = true;

onEdited();
},
onDragEnd: function(index, position) {
if (position) {
_self.positions[index] = position;
updateHalfMarkers(index, _self.positions);
_self._createPrimitive = true;
}

delete _self._handlingDragOperation;

onEdited();
}
},
Expand Down Expand Up @@ -1354,8 +1343,6 @@ var DrawHelper = (function() {
_self._markers.insertBillboard(this.index, position, _getMarkerChangeHandlers(_self));
_self._editMarkers.getBillboard(this.index - 1).position = _calculateHalfMarkerPosition(_self.positions, this.index - 1);
_self._editMarkers.insertBillboard(this.index, _calculateHalfMarkerPosition(_self.positions, this.index), _getEditMarkerChangeHandlers(_self));

onEdited();
},
onDrag: function(index, position) {
_self.positions[this.index] = position;
Expand All @@ -1364,18 +1351,9 @@ var DrawHelper = (function() {
_self._markers.getBillboard(this.index).position = position;
_self._editMarkers.getBillboard(this.index - 1).position = _calculateHalfMarkerPosition(_self.positions, this.index - 1);
_self._editMarkers.getBillboard(this.index).position = _calculateHalfMarkerPosition(_self.positions, this.index);

onEdited();
},
onDragEnd: function(index, position) {
// create new sets of makers for editing
//_self._markers.insertBillboard(this.index, position, handleMarkerChanges);
//_self._editMarkers.getBillboard(this.index - 1).position = _calculateHalfMarkerPosition(_self.positions, this.index - 1);
//_self._editMarkers.insertBillboard(this.index, _calculateHalfMarkerPosition(_self.positions, this.index), handleEditMarkerChanges);
_self._createPrimitive = true;

delete _self._handlingDragOperation;

onEdited();
}
},
Expand Down Expand Up @@ -1479,9 +1457,6 @@ var DrawHelper = (function() {
}

_self._createPrimitive = true;

onEdited();

_self._initialPrimitiveDragPosition = position;
},
onDragEnd: function onDragEnd(position) {
Expand Down Expand Up @@ -1888,8 +1863,6 @@ var DrawHelper = (function() {

_self._createPrimitive = true;

onEdited();

_self._initialPrimitiveDragPosition = position;
},
onDragEnd: function onDragEnd(position) {
Expand Down Expand Up @@ -2068,8 +2041,6 @@ var DrawHelper = (function() {

_self._createPrimitive = true;

onEdited();

_self._initialPrimitiveDragPosition = position;
},
onDragEnd: function onDragEnd(position) {
Expand Down

0 comments on commit 9c07a5e

Please sign in to comment.