moved some vars to namespace
This commit is contained in:
		@@ -30,18 +30,19 @@ window.plugin.maxLinks.STROKE_STYLE = {
 | 
				
			|||||||
  clickable: false,
 | 
					  clickable: false,
 | 
				
			||||||
  smoothFactor: 10
 | 
					  smoothFactor: 10
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
var delaunayScriptLocation = 'https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/delaunay.js';
 | 
					window.plugin.maxLinks._delaunayScriptLocation = 'https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/dist/delaunay.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
window.plugin.maxLinks.layer = null;
 | 
					window.plugin.maxLinks.layer = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var updating = false;
 | 
					window.plugin.maxLinks._updating = false;
 | 
				
			||||||
var renderLimitReached = false;
 | 
					window.plugin.maxLinks._renderLimitReached = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
window.plugin.maxLinks.updateLayer = function() {
 | 
					window.plugin.maxLinks.updateLayer = function() {
 | 
				
			||||||
  if (updating || window.plugin.maxLinks.layer === null || 
 | 
					  if (window.plugin.maxLinks._updating || 
 | 
				
			||||||
 | 
					      window.plugin.maxLinks.layer === null || 
 | 
				
			||||||
      !window.map.hasLayer(window.plugin.maxLinks.layer))
 | 
					      !window.map.hasLayer(window.plugin.maxLinks.layer))
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  updating = true;
 | 
					  window.plugin.maxLinks._updating = true;
 | 
				
			||||||
  window.plugin.maxLinks.layer.clearLayers();
 | 
					  window.plugin.maxLinks.layer.clearLayers();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  var locations = [];
 | 
					  var locations = [];
 | 
				
			||||||
@@ -65,7 +66,7 @@ window.plugin.maxLinks.updateLayer = function() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  var triangles = window.delaunay.triangulate(locations);
 | 
					  var triangles = window.delaunay.triangulate(locations);
 | 
				
			||||||
  var drawnLinks = 0;
 | 
					  var drawnLinks = 0;
 | 
				
			||||||
  renderLimitReached = false;
 | 
					  window.plugin.maxLinks._renderLimitReached = false;
 | 
				
			||||||
  var renderlimit = window.USE_INCREASED_RENDER_LIMIT ? 
 | 
					  var renderlimit = window.USE_INCREASED_RENDER_LIMIT ? 
 | 
				
			||||||
    window.plugin.maxLinks.MAX_DRAWN_LINKS_INCREASED_LIMIT : 
 | 
					    window.plugin.maxLinks.MAX_DRAWN_LINKS_INCREASED_LIMIT : 
 | 
				
			||||||
    window.plugin.maxLinks.MAX_DRAWN_LINKS;
 | 
					    window.plugin.maxLinks.MAX_DRAWN_LINKS;
 | 
				
			||||||
@@ -74,15 +75,15 @@ window.plugin.maxLinks.updateLayer = function() {
 | 
				
			|||||||
      triangle.draw(window.plugin.maxLinks.layer, minX, minY)
 | 
					      triangle.draw(window.plugin.maxLinks.layer, minX, minY)
 | 
				
			||||||
      drawnLinks += 3;
 | 
					      drawnLinks += 3;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      renderLimitReached = true;
 | 
					      window.plugin.maxLinks._renderLimitReached = true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  updating = false;
 | 
					  window.plugin.maxLinks._updating = false;
 | 
				
			||||||
  window.renderUpdateStatus();
 | 
					  window.renderUpdateStatus();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
var setup = function() {
 | 
					window.plugin.maxLinks.setup = function() {
 | 
				
			||||||
  load(delaunayScriptLocation).thenRun(function() {
 | 
					  load(window.plugin.maxLinks._delaunayScriptLocation).thenRun(function() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    window.delaunay.Triangle.prototype.draw = function(layer, divX, divY) {
 | 
					    window.delaunay.Triangle.prototype.draw = function(layer, divX, divY) {
 | 
				
			||||||
      var drawLine = function(src, dest) {
 | 
					      var drawLine = function(src, dest) {
 | 
				
			||||||
@@ -98,7 +99,8 @@ var setup = function() {
 | 
				
			|||||||
    window.plugin.maxLinks.layer = L.layerGroup([]);
 | 
					    window.plugin.maxLinks.layer = L.layerGroup([]);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    window.addHook('checkRenderLimit', function(e) {
 | 
					    window.addHook('checkRenderLimit', function(e) {
 | 
				
			||||||
       if (window.map.hasLayer(window.plugin.maxLinks.layer) && renderLimitReached)
 | 
					       if (window.map.hasLayer(window.plugin.maxLinks.layer) && 
 | 
				
			||||||
 | 
					           window.plugin.maxLinks._renderLimitReached)
 | 
				
			||||||
         e.reached = true; 
 | 
					         e.reached = true; 
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -110,6 +112,7 @@ var setup = function() {
 | 
				
			|||||||
    window.layerChooser.addOverlay(window.plugin.maxLinks.layer, 'Maximum Links');
 | 
					    window.layerChooser.addOverlay(window.plugin.maxLinks.layer, 'Maximum Links');
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					var setup = window.plugin.maxLinks.setup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PLUGIN END //////////////////////////////////////////////////////////
 | 
					// PLUGIN END //////////////////////////////////////////////////////////
 | 
				
			||||||
if(window.iitcLoaded && typeof setup === 'function') {
 | 
					if(window.iitcLoaded && typeof setup === 'function') {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user