Advertisement
Guest User

Untitled

a guest
Jan 28th, 2013
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. L.SLMarkers = L.Class.extend({
  2.     initialize: function() {
  3.     },
  4.  
  5.     onAdd: function (map) {
  6.     this._map = map;
  7.  
  8.     this._initContainer();
  9.     map.getPanes().mapPane.appendChild(this._el);
  10.     this._setPosition();
  11.     },
  12.  
  13.     onRemove: function(map) {
  14.     map.getPanes().mapPane.removeChild(this._el);
  15.     },
  16.  
  17.     _setPosition: function() {
  18.     var pos = this._map.getCenter();
  19.     L.DomUtil.setPosition(this._el, pos);
  20.     },
  21.  
  22.     _initContainer: function() {
  23.     var el = L.DomUtil.create('div', 'slmarker-cross');
  24.  
  25.     el.innerHTML = '<a href="#">X</a>';
  26.     el.style.zIndex = 10000;
  27.     el.style.width = 64;
  28.     el.style.height = 64;
  29.     el.style.position = "absolute";
  30.     el.style.top = "50%";
  31.     el.style.left = "50%";
  32.  
  33.     this._el = el;
  34.     }
  35. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement