From 9c07a5e97427788f74f1c7321189e140f9295a78 Mon Sep 17 00:00:00 2001 From: Brandon McAllister Date: Wed, 3 Feb 2016 12:18:05 -0600 Subject: [PATCH] Only fire edited event on drag end 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. --- DrawHelper.js | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/DrawHelper.js b/DrawHelper.js index eb2c9cc..dcf87b9 100644 --- a/DrawHelper.js +++ b/DrawHelper.js @@ -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(); } }, @@ -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; @@ -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(); } }, @@ -1479,9 +1457,6 @@ var DrawHelper = (function() { } _self._createPrimitive = true; - - onEdited(); - _self._initialPrimitiveDragPosition = position; }, onDragEnd: function onDragEnd(position) { @@ -1888,8 +1863,6 @@ var DrawHelper = (function() { _self._createPrimitive = true; - onEdited(); - _self._initialPrimitiveDragPosition = position; }, onDragEnd: function onDragEnd(position) { @@ -2068,8 +2041,6 @@ var DrawHelper = (function() { _self._createPrimitive = true; - onEdited(); - _self._initialPrimitiveDragPosition = position; }, onDragEnd: function onDragEnd(position) {