commit cd6eae74fd67b5bd41d625365eb6b02a0c04fcba
parent 20eee8b4cf39b08c2089701ff0f7686e3dd00a79
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Wed, 15 Feb 2017 22:10:03 +0300
removed duplicate popup-window module; made westra passes window uniq and wider
Diffstat:
3 files changed, 2 insertions(+), 30 deletions(-)
diff --git a/src/lib/leaflet.layer.westraPasses/westraPassesMarkers.js b/src/lib/leaflet.layer.westraPasses/westraPassesMarkers.js
@@ -1,6 +1,6 @@
import L from 'leaflet';
import 'lib/leaflet.layer.canvasMarkers'
-import openPopup from 'lib/popupWindow';
+import {openPopupWindow} from 'lib/popup-window';
import escapeHtml from 'escape-html';
import {saveAs} from 'browser-filesaver';
import iconFromBackgroundImage from 'lib/iconFromBackgroundImage';
@@ -217,7 +217,7 @@ const WestraPassesMarkers = L.Layer.CanvasMarkers.extend({
</table>`;
this._map.openPopup(description, latLng, {maxWidth: 500});
document.getElementById('westra-pass-link').onclick = function() {
- openPopup(url, 650);
+ openPopupWindow(url, 780, 'westra-details');
return false;
};
document.getElementById('westra-pass-gpx').onclick = function() {
diff --git a/src/lib/popup-window/index.js b/src/lib/popup-window/index.js
@@ -1,7 +1,6 @@
function openPopupWindow(url, width, uniqName = null) {
var left, top, height,
screenLeft = screen.availLeft || 0,
- screenTop = screen.availTop || 0,
bordersWidth = 8;
// if browser window is in the right half of screen, place new window on left half
if (window.screenX - screenLeft - bordersWidth * 1.5 > width) {
diff --git a/src/lib/popupWindow/index.js b/src/lib/popupWindow/index.js
@@ -1,27 +0,0 @@
-function openPopup (url, width) {
- var left, top, height,
- screenLeft = screen.availLeft || 0,
- bordersWidth = 8;
- // if browser window is in the right half of screen, place new window on left half
- if (window.screenX - screenLeft - bordersWidth * 1.5 > width) {
- left = window.screenX - width - bordersWidth * 1.5;
- // if browser window is in the left half of screen, place new window on right half
- } else if (window.screenX + window.outerWidth + width + bordersWidth * 1.5 < screenLeft + screen.availWidth) {
- left = window.screenX + window.outerWidth + bordersWidth;
- // if screen is small or browser window occupies whole screen, place new window on top of current window
- } else {
- left = window.screenX + window.outerWidth / 2 - width / 2;
- if (left < 0) {
- left = 0;
- }
- }
- top = window.screenY;
- height = window.innerHeight;
- var features = 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top;
- features += ',resizable,scrollbars';
- // to open single instance replace null with some string
- window.open(url, null, features)
- .focus();
-}
-
-export default openPopup;