geojs 1.8.4 → 1.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # GeoJS Change Log
2
2
 
3
+ ## Version 1.8.5
4
+
5
+ ### Improvements
6
+
7
+ -Optimize reordering fetch queue ([#1203](../../pull/1203))
8
+
3
9
  ## Version 1.8.4
4
10
 
5
11
  ### Improvements
package/geo.js CHANGED
@@ -10905,9 +10905,8 @@ var fetchQueue = function fetchQueue(options) {
10905
10905
  var pos = $.inArray(defer, m_this._queue);
10906
10906
 
10907
10907
  if (pos >= 0) {
10908
- m_this._queue.splice(pos, 1);
10909
-
10910
- m_this._addToQueue(defer, atEnd);
10908
+ // m_this._queue.splice(pos, 1);
10909
+ m_this._addToQueue(defer, atEnd, pos);
10911
10910
 
10912
10911
  return defer;
10913
10912
  }
@@ -10941,24 +10940,40 @@ var fetchQueue = function fetchQueue(options) {
10941
10940
  * @param {boolean} atEnd If falsy, add the item to the front of the queue
10942
10941
  * if batching is turned off or at the end of the current batch if it is
10943
10942
  * turned on. If truthy, always add the item to the end of the queue.
10943
+ * @param {number} [pos] If specified, the current location in the queue of
10944
+ * the object being added. This avoids having to splice, push, or unshift
10945
+ * the queue.
10944
10946
  */
10945
10947
 
10946
10948
 
10947
- this._addToQueue = function (defer, atEnd) {
10949
+ this._addToQueue = function (defer, atEnd, pos) {
10950
+ var move = atEnd ? m_this._queue.length - 1 : 0;
10948
10951
  defer.__fetchQueue._batch = m_this._batch;
10949
10952
 
10950
- if (atEnd) {
10951
- m_this._queue.push(defer);
10952
- } else if (!m_this._batch) {
10953
- m_this._queue.unshift(defer);
10954
- } else {
10955
- for (var i = 0; i < m_this._queue.length; i += 1) {
10956
- if (m_this._queue[i].__fetchQueue._batch !== m_this._batch) {
10953
+ if (!atEnd && m_this._batch) {
10954
+ for (move = 0; move < m_this._queue.length - (pos === undefined ? 0 : 1); move += 1) {
10955
+ if (m_this._queue[move].__fetchQueue._batch !== m_this._batch) {
10957
10956
  break;
10958
10957
  }
10959
10958
  }
10959
+ }
10960
+
10961
+ if (pos === undefined) {
10962
+ if (atEnd) {
10963
+ m_this._queue.push(defer);
10964
+ } else if (!move) {
10965
+ m_this._queue.unshift(defer);
10966
+ } else {
10967
+ m_this._queue.splice(move, 0, defer);
10968
+ }
10969
+ } else if (pos !== move) {
10970
+ var dir = pos < move ? 1 : -1;
10971
+
10972
+ for (var i = pos; i !== move; i += dir) {
10973
+ m_this._queue[i] = m_this._queue[i + dir];
10974
+ }
10960
10975
 
10961
- m_this._queue.splice(i, 0, defer);
10976
+ m_this._queue[move] = defer;
10962
10977
  }
10963
10978
  };
10964
10979
  /**
@@ -26856,7 +26871,7 @@ module.exports = sceneObject;
26856
26871
  * @constant
26857
26872
  * @type {string}
26858
26873
  */
26859
- module.exports = "aa7a52c0facebedfe694ae91d1f9a295ade8765e";
26874
+ module.exports = "c8c9edda606de6cb2990b41bfdfe2c4a82c885cb";
26860
26875
 
26861
26876
  /***/ }),
26862
26877
 
@@ -39346,7 +39361,7 @@ module.exports = vectorFeature;
39346
39361
  * @constant
39347
39362
  * @type {string}
39348
39363
  */
39349
- module.exports = "1.8.4";
39364
+ module.exports = "1.8.5";
39350
39365
 
39351
39366
  /***/ }),
39352
39367
 
package/geo.lean.js CHANGED
@@ -10905,9 +10905,8 @@ var fetchQueue = function fetchQueue(options) {
10905
10905
  var pos = $.inArray(defer, m_this._queue);
10906
10906
 
10907
10907
  if (pos >= 0) {
10908
- m_this._queue.splice(pos, 1);
10909
-
10910
- m_this._addToQueue(defer, atEnd);
10908
+ // m_this._queue.splice(pos, 1);
10909
+ m_this._addToQueue(defer, atEnd, pos);
10911
10910
 
10912
10911
  return defer;
10913
10912
  }
@@ -10941,24 +10940,40 @@ var fetchQueue = function fetchQueue(options) {
10941
10940
  * @param {boolean} atEnd If falsy, add the item to the front of the queue
10942
10941
  * if batching is turned off or at the end of the current batch if it is
10943
10942
  * turned on. If truthy, always add the item to the end of the queue.
10943
+ * @param {number} [pos] If specified, the current location in the queue of
10944
+ * the object being added. This avoids having to splice, push, or unshift
10945
+ * the queue.
10944
10946
  */
10945
10947
 
10946
10948
 
10947
- this._addToQueue = function (defer, atEnd) {
10949
+ this._addToQueue = function (defer, atEnd, pos) {
10950
+ var move = atEnd ? m_this._queue.length - 1 : 0;
10948
10951
  defer.__fetchQueue._batch = m_this._batch;
10949
10952
 
10950
- if (atEnd) {
10951
- m_this._queue.push(defer);
10952
- } else if (!m_this._batch) {
10953
- m_this._queue.unshift(defer);
10954
- } else {
10955
- for (var i = 0; i < m_this._queue.length; i += 1) {
10956
- if (m_this._queue[i].__fetchQueue._batch !== m_this._batch) {
10953
+ if (!atEnd && m_this._batch) {
10954
+ for (move = 0; move < m_this._queue.length - (pos === undefined ? 0 : 1); move += 1) {
10955
+ if (m_this._queue[move].__fetchQueue._batch !== m_this._batch) {
10957
10956
  break;
10958
10957
  }
10959
10958
  }
10959
+ }
10960
+
10961
+ if (pos === undefined) {
10962
+ if (atEnd) {
10963
+ m_this._queue.push(defer);
10964
+ } else if (!move) {
10965
+ m_this._queue.unshift(defer);
10966
+ } else {
10967
+ m_this._queue.splice(move, 0, defer);
10968
+ }
10969
+ } else if (pos !== move) {
10970
+ var dir = pos < move ? 1 : -1;
10971
+
10972
+ for (var i = pos; i !== move; i += dir) {
10973
+ m_this._queue[i] = m_this._queue[i + dir];
10974
+ }
10960
10975
 
10961
- m_this._queue.splice(i, 0, defer);
10976
+ m_this._queue[move] = defer;
10962
10977
  }
10963
10978
  };
10964
10979
  /**
@@ -26856,7 +26871,7 @@ module.exports = sceneObject;
26856
26871
  * @constant
26857
26872
  * @type {string}
26858
26873
  */
26859
- module.exports = "aa7a52c0facebedfe694ae91d1f9a295ade8765e";
26874
+ module.exports = "c8c9edda606de6cb2990b41bfdfe2c4a82c885cb";
26860
26875
 
26861
26876
  /***/ }),
26862
26877
 
@@ -39346,7 +39361,7 @@ module.exports = vectorFeature;
39346
39361
  * @constant
39347
39362
  * @type {string}
39348
39363
  */
39349
- module.exports = "1.8.4";
39364
+ module.exports = "1.8.5";
39350
39365
 
39351
39366
  /***/ }),
39352
39367