|
9 | 9 | <script src="../proj4Leaflet/src/proj4leaflet.js"></script> |
10 | 10 | <script src="../mapml-leaflet-plugin/mapml.min.js"></script> |
11 | 11 |
|
12 | | - |
13 | 12 | <dom-module id="layer-"> |
14 | 13 | <!-- in polymer 1.0.x, styles must be outside of the <template> element |
15 | 14 | https://www.polymer-project.org/1.0/docs/migration.html#local-dom-template --> |
|
169 | 168 | // zoom range, extent and projection are. meta elements in content to |
170 | 169 | // allow the author to provide this explicitly are one way, they will |
171 | 170 | // be parsed from the second parameter here |
172 | | - this._layer = M.mapMLLayer(this.src ? new URI(this.src).resolve(new URI(this.baseURI)).toString(): null, this); |
| 171 | + // IE 11 did not have a value for this.baseURI for some reason |
| 172 | + var base = this.baseURI ? this.baseURI : document.baseURI; |
| 173 | + this._layer = M.mapMLLayer(this.src ? new URI(this.src).resolve(new URI(base)).toString(): null, this); |
173 | 174 | this._layer.on('extentload', this._onLayerExtentLoad, this); |
174 | 175 | }, |
175 | 176 | _attachedToMap: function() { |
176 | 177 | // set i to the index of this layer element in the set of layers |
177 | 178 | var i = 0; |
178 | | - for (var nodes = this.parentNode.children;i < nodes.length;i++) { |
179 | | - if (this.parentNode.children[i] === this) { |
| 179 | + for (var nodes = Polymer.dom(this).parentNode.children;i < nodes.length;i++) { |
| 180 | + if (Polymer.dom(this).parentNode.children[i] === this) { |
180 | 181 | break; |
181 | 182 | } |
182 | 183 | } |
183 | 184 | L.setOptions(this._layer, {zIndex: i+1, opacity: window.getComputedStyle(this).opacity}); |
184 | 185 | // make sure the Leaflet layer has a reference to the map |
185 | | - this._layer._map = this.parentElement._map; |
| 186 | + this._layer._map = Polymer.dom(this).parentNode._map; |
186 | 187 | // notify the layer that it is attached to a map (layer._map) |
187 | 188 | this._layer.fire('attached'); |
188 | 189 |
|
|
195 | 196 | this._layer.on('add remove', this._onLayerChange, this); |
196 | 197 |
|
197 | 198 | // if controls option is enabled, insert the layer into the overlays array |
198 | | - if (this.parentElement.controls && !this.hidden) { |
199 | | - this._layerControl = this.parentElement._layerControl; |
| 199 | + if (Polymer.dom(this).parentNode.controls && !this.hidden) { |
| 200 | + this._layerControl = Polymer.dom(this).parentNode._layerControl; |
200 | 201 | this._layerControl.addOverlay(this._layer, this.label); |
201 | 202 | } |
202 | 203 | // toggle the this.disabled attribute depending on whether the layer |
|
210 | 211 | this._layer._map.fire('moveend'); |
211 | 212 | }, |
212 | 213 | attached: function() { |
213 | | - if (this.parentElement.nodeName !== 'MAP') { |
| 214 | + if (Polymer.dom(this).parentNode.nodeName !== 'MAP') { |
214 | 215 | console.log('ERROR: '+ this.localName + '#' + this.id + ' must be a child of a map element'); |
215 | 216 | return; |
216 | 217 | } |
217 | 218 | // if the map has been attached, set this layer up wrt Leaflet map |
218 | | - if (this.parentElement._map) { |
| 219 | + if (Polymer.dom(this).parentNode._map) { |
219 | 220 | this._attachedToMap(); |
220 | 221 | } |
221 | 222 | } |
|
0 commit comments