[fusion-commits] r3049 - trunk/layers/MapGuide
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Tue Mar 5 02:50:33 PST 2019
Author: jng
Date: 2019-03-05 02:50:33 -0800 (Tue, 05 Mar 2019)
New Revision: 3049
Modified:
trunk/layers/MapGuide/MapGuide.js
Log:
Fix Google Maps offset. Don't re-define Array.find and Array.remove (the cause of so many Google Maps breakges), just have dedicated array functions for that purpose.
I can verify with this change that the (heavily watermarked, pestering me to cough up a credit card for billing) Google Maps tiles do line up with the map again.
Fixes #665
Modified: trunk/layers/MapGuide/MapGuide.js
===================================================================
--- trunk/layers/MapGuide/MapGuide.js 2018-10-01 13:57:45 UTC (rev 3048)
+++ trunk/layers/MapGuide/MapGuide.js 2019-03-05 10:50:33 UTC (rev 3049)
@@ -23,6 +23,29 @@
* DEALINGS IN THE SOFTWARE.
*/
+
+function arrayFind(array, searchStr) {
+ var returnArray = null;
+ for (i=0; i<array.length; i++) {
+ if (typeof(searchStr) == 'function' && typeof(searchStr.test) == 'function') {
+ if (searchStr.test(array[i])) {
+ if (!returnArray) { returnArray = [] }
+ returnArray.push(i);
+ }
+ } else {
+ if (array[i]===searchStr) {
+ if (!returnArray) { returnArray = [] }
+ returnArray.push(i);
+ }
+ }
+ }
+ return returnArray;
+}
+
+function arrayRemove(array, indexToRemove) {
+ array.splice(indexToRemove, 1);
+}
+
/***************************************************************************
* Class: Fusion.Layers.MapGuide
*
@@ -2541,7 +2564,7 @@
// add the previously selected features for this layer
for (var j = 0; j < prevSelLayer.getNumFeatures(); j++)
{
- var prevSelFeatureIndexes = currentLayer.featIds.find(prevSelLayer.featIds[j]);
+ var prevSelFeatureIndexes = arrayFind(currentLayer.featIds, prevSelLayer.featIds[j]);
if (prevSelFeatureIndexes == null)
{
currentLayer.addFeature(prevSelLayer.featIds[j]);
@@ -2593,7 +2616,7 @@
var index = this.getLayerIndex(layer);
if (index >=0 && index < this.nLayers)
{
- this.aLayers.remove(index);
+ arrayRemove(this.aLayers, index);
this.nLayers--;
}
},
@@ -2645,30 +2668,8 @@
var numIndexes = featureIndexes.length;
for (var featIndex = 0; featIndex < numIndexes; featIndex++)
{
- this.featIds.remove(featureIndexes[featIndex]);
+ arrayRemove(this.featIds, featureIndexes[featIndex]);
this.nFeatures--;
}
}
-});
-
-Array.prototype.find = function(searchStr) {
- var returnArray = null;
- for (i=0; i<this.length; i++) {
- if (typeof(searchStr) == 'function' && typeof(searchStr.test) == 'function') {
- if (searchStr.test(this[i])) {
- if (!returnArray) { returnArray = [] }
- returnArray.push(i);
- }
- } else {
- if (this[i]===searchStr) {
- if (!returnArray) { returnArray = [] }
- returnArray.push(i);
- }
- }
- }
- return returnArray;
-};
-
-Array.prototype.remove = function(indexToRemove) {
- this.splice(indexToRemove, 1);
-};
\ No newline at end of file
+});
\ No newline at end of file
More information about the fusion-commits
mailing list