Skip to content

Commit 4a11256

Browse files
authored
Merge pull request #42 from prushforth/builds
Fix issues in builds uncovered in 0.1.0 release due to not using the most recent
2 parents b83618c + b1bdb1d commit 4a11256

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

map-area.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<!-- this is a modified version of leaflet which uses Polymer.dom instead of
66
regular DOM API calls so as to work with Shadow/Shady DOM custom elements -->
7-
<script src="../polymer-leaflet/leaflet.js"></script>
7+
<script src="../polymer-leaflet/leaflet-src.js"></script>
88
<script src="../proj4Leaflet/lib/proj4-compressed.js"></script>
99
<script src="../proj4Leaflet/src/proj4leaflet.js"></script>
1010
<script src="../mapml-leaflet-plugin/mapml.min.js"></script>

map-layer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<!-- this is a modified version of leaflet which uses Polymer.dom instead of
66
regular DOM API calls so as to work with Shadow/Shady DOM custom elements -->
7-
<script src="../polymer-leaflet/leaflet.js"></script>
7+
<script src="../polymer-leaflet/leaflet-src.js"></script>
88
<script src="../proj4Leaflet/lib/proj4-compressed.js"></script>
99
<script src="../proj4Leaflet/src/proj4leaflet.js"></script>
1010
<script src="../mapml-leaflet-plugin/mapml.min.js"></script>

web-map.html

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<!-- this is a modified version of leaflet which uses Polymer.dom instead of
88
regular DOM API calls so as to work with Shadow/Shady DOM custom elements -->
9-
<script src="../polymer-leaflet/leaflet.js"></script>
9+
<script src="../polymer-leaflet/leaflet-src.js"></script>
1010
<script src="../proj4Leaflet/lib/proj4-compressed.js"></script>
1111
<script src="../proj4Leaflet/src/proj4leaflet.js"></script>
1212
<script src="../mapml-leaflet-plugin/mapml.min.js"></script>
@@ -149,6 +149,28 @@
149149
this.lon = this._map.getCenter().lng;
150150
this.zoom = this._map.getZoom();
151151
},
152+
ready: function () {
153+
// when used in a custom element, the leaflet script element is hidden inside
154+
// the import's shadow dom.
155+
L.Icon.Default.imagePath = (function () {
156+
var imp = document.querySelector('link[rel="import"][href*="web-map.html"]'),
157+
doc = imp ? imp.import : document,
158+
scripts = doc.getElementsByTagName('script'),
159+
leafletRe = /[\/^]leaflet[\-\._]?([\w\-\._]*)\.js\??/;
160+
161+
var i, len, src, path;
162+
163+
for (i = 0, len = scripts.length; i < len; i++) {
164+
src = scripts[i].src;
165+
166+
if (src.match(leafletRe)) {
167+
path = src.split(leafletRe)[0];
168+
return (path ? path + '/' : '') + 'images';
169+
}
170+
}
171+
}());
172+
173+
},
152174
attached: function() {
153175
this.async( function () {
154176
console.log(this.localName + '#' + this.id + ' was attached');
@@ -180,11 +202,11 @@
180202
// _container.innerHTML does not work properly if the engine is throwing
181203
// exceptions because there are no area element children of the image map
182204
// for firefox only, a workaround is to actually remove the image...
183-
if (L.Browser.gecko) {
184-
this.poster.removeAttribute('usemap');
185-
}
186205
if (this.poster) {
187-
Polymer.dom(this.$.map).appendChild(this.poster);
206+
if (L.Browser.gecko) {
207+
this.poster.removeAttribute('usemap');
208+
}
209+
Polymer.dom(this.$.map).appendChild(this.poster);
188210
}
189211
}
190212
}

0 commit comments

Comments
 (0)