commit 8c53958a9016e6b4146387e77a8ae609b8111370
parent ef62c0c686e38d74076687157996a33d00eeccaa
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Tue, 28 Feb 2017 10:27:05 +0300
misc fixes and workariunds for IE
Diffstat:
9 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/src/lib/leaflet.control.commons/index.js b/src/lib/leaflet.control.commons/index.js
@@ -4,11 +4,8 @@ L.Control.include({
_stopContainerEvents: function() {
const container = this._container;
L.DomEvent.disableClickPropagation(container);
- if (!L.Browser.touch) {
- L.DomEvent.disableScrollPropagation(container);
- } else {
- L.DomEvent.on(container, 'mousemove', L.DomEvent.stop);
- }
+ L.DomEvent.disableScrollPropagation(container);
+ L.DomEvent.on(container, 'mousemove', L.DomEvent.stop);
}
});
diff --git a/src/lib/leaflet.control.layers.configure/index.js b/src/lib/leaflet.control.layers.configure/index.js
@@ -282,7 +282,7 @@ ${buttonsHtml}`;
tms: form.tms.checked,
scaleDependent: form.scaleDependent.checked,
maxZoom: form.maxZoom.value,
- isOverlay: form.overlay.value === 'yes'
+ isOverlay: form.querySelector('input[name="overlay"]:checked').value === 'yes'
};
callback(fieldValues);
}
diff --git a/src/lib/leaflet.control.layers.hotkeys/index.js b/src/lib/leaflet.control.layers.hotkeys/index.js
@@ -67,7 +67,7 @@ function enableHotKeys(control) {
let layerId = L.stamp(layer.layer);
if (layer.layer.options && layer.layer.options.code && layer.layer.options.code.toUpperCase() === key) {
const inputs = this._form.getElementsByTagName('input');
- for (let input of inputs) {
+ for (let input of [...inputs]) {
if (input.layerId === layerId) {
input.click();
break;
diff --git a/src/lib/leaflet.control.panoramas/index.js b/src/lib/leaflet.control.panoramas/index.js
@@ -5,6 +5,12 @@ import getGoogle from 'lib/googleMapsApi';
import 'lib/leaflet.hashState/leaflet.hashState';
import 'lib/leaflet.control.commons';
+function fireRefreshEventOnWindow() {
+ const evt = document.createEvent("HTMLEvents");
+ evt.initEvent('resize', true, false);
+ window.dispatchEvent(evt);
+}
+
L.Control.Panoramas = L.Control.extend({
includes: L.Mixin.Events,
@@ -52,7 +58,7 @@ L.Control.Panoramas = L.Control.extend({
}
L.DomUtil.addClass(this._panoramaContainer, 'enabled');
this.getGoogleApi().then((api) => api.panorama.setVisible(true));
- window.dispatchEvent(new Event('resize'));
+ fireRefreshEventOnWindow();
this.marker.addTo(this._map);
this.panoramaVisible = true;
this.notifyChanged();
@@ -64,7 +70,7 @@ L.Control.Panoramas = L.Control.extend({
}
this.getGoogleApi().then((api) => api.panorama.setVisible(false));
L.DomUtil.removeClass(this._panoramaContainer, 'enabled');
- window.dispatchEvent(new Event('resize'));
+ fireRefreshEventOnWindow();
this._map.removeLayer(this.marker);
this.panoramaVisible = false;
this.notifyChanged();
diff --git a/src/lib/leaflet.control.printPages/map-render.js b/src/lib/leaflet.control.printPages/map-render.js
@@ -29,7 +29,7 @@ function getLayersForPrint(map, xhrQueue) {
const order = [];
while (el !== layer._map._container) {
order.push(getZIndex(el));
- el = el.parentElement;
+ el = el.parentNode;
}
return order.reverse()
}
diff --git a/src/lib/leaflet.control.track-list/lib/geo_file_formats.js b/src/lib/leaflet.control.track-list/lib/geo_file_formats.js
@@ -74,7 +74,11 @@ function parseGpx(txt, name) {
txt = stripBom(txt);
// remove namespaces
txt = txt.replace(/<([^ >]+):([^ >]+)/g, '<$1_$2');
- var dom = (new DOMParser()).parseFromString(txt, "text/xml");
+ try {
+ var dom = (new DOMParser()).parseFromString(txt, "text/xml");
+ } catch (e) {
+ return null;
+ }
if (dom.documentElement.nodeName === 'parsererror') {
return null;
}
@@ -262,7 +266,11 @@ function parseKml(txt, name) {
txt = stripBom(txt);
txt = txt.replace(/<([^ >]+):([^ >]+)/g, '<$1_$2');
- var dom = (new DOMParser()).parseFromString(txt, "text/xml");
+ try {
+ var dom = (new DOMParser()).parseFromString(txt, "text/xml");
+ } catch (e) {
+ return null;
+ }
if (dom.documentElement.nodeName === 'parsererror') {
return null;
}
diff --git a/src/lib/leaflet.fixes/index.js b/src/lib/leaflet.fixes/index.js
@@ -1,4 +1,5 @@
import L from 'leaflet';
+import './style.css';
function fixAll() {
fixPanAnimationBug();
@@ -22,7 +23,7 @@ function fixPanAnimationBug() {
}
function fixTouchDetection() {
- L.Browser.touch &= (navigator.pointerEnabled || navigator.maxTouchPoints)
+ L.Browser.touch &= ((navigator.pointerEnabled && !L.Browser.ie)|| navigator.maxTouchPoints)
}
export {fixAll}
diff --git a/src/lib/leaflet.fixes/style.css b/src/lib/leaflet.fixes/style.css
@@ -0,0 +1,3 @@
+.leaflet-popup-pane, .leaflet-control {
+ cursor: default;
+}
+\ No newline at end of file
diff --git a/src/lib/leaflet.layer.wikimapia/index.js b/src/lib/leaflet.layer.wikimapia/index.js
@@ -190,7 +190,7 @@ L.Wikimapia = L.GridLayer.extend({
const place = this.getPlaceAtMousePos(e);
if (place) {
const url = `http://wikimapia.org/${place.id}/ru/`;
- openPopupWindow(url, 568, 'wikimapia-details');
+ openPopupWindow(url, 564, 'wikimapia-details');
}
},