diff --git a/frontend/css/pad.css b/frontend/css/pad.css index f40b94dc..be5d085f 100644 --- a/frontend/css/pad.css +++ b/frontend/css/pad.css @@ -240,7 +240,7 @@ textarea { } .fp-popup-bottom { - margin-top: 50px; + margin-top: 51px; } .fp-popup-bottom:before { diff --git a/frontend/js/fpMap.js b/frontend/js/fpMap.js index 1a0dc9b6..8cbcbc33 100644 --- a/frontend/js/fpMap.js +++ b/frontend/js/fpMap.js @@ -75,7 +75,7 @@ } }, "click" : function(obj) { - obj.fpOnClick(map.xyToPos(map.featureHandler.up)); + obj.fpOnClick(map.xyToPos(map.featureHandler.up), map.featureHandler.evt); } }, { map: map.map }); map.featureHandler.activate(); @@ -167,8 +167,8 @@ }; var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(marker.lon, marker.lat).transform(fpUtils.proj(), map.map.getProjectionObject()), null, style); feature.fpMarker = marker; - feature.fpOnClick = function() { - map.mapEvents.$emit("clickMarker", marker); + feature.fpOnClick = function(pos, evt) { + map.mapEvents.$emit("clickMarker", marker, evt); }; map.layerLines.addFeatures([ feature ]); map.markersById[marker.id] = feature; @@ -206,8 +206,8 @@ var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(points).transform(fpUtils.proj(), map.map.getProjectionObject()), null, style); feature.fpLine = line; - feature.fpOnClick = function(clickPos) { - map.mapEvents.$emit("clickLine", line, clickPos); + feature.fpOnClick = function(clickPos, evt) { + map.mapEvents.$emit("clickLine", line, clickPos, evt); }; map.layerLines.addFeatures([ feature ]); map.linesById[line.id] = feature; @@ -367,11 +367,6 @@ fpMapLegend(map); fpMapSearch(map); - map.mapEvents.$on("clickLine", function(e, line, clickPos) { - map.popups.closeAll(); - map.linesUi.viewLine(line, clickPos); - }); - map.socket.$on("loadStart", function() { map.loadStart(); }); diff --git a/frontend/js/fpMapLines.js b/frontend/js/fpMapLines.js index 0a0b117c..c0e97bd1 100644 --- a/frontend/js/fpMapLines.js +++ b/frontend/js/fpMapLines.js @@ -150,6 +150,25 @@ }); } }; + + map.mapEvents.$on("clickLine", function(e, line, clickPos, evt) { + var one = false; + map.popups.getOpenPopups().forEach(function(popup) { + if(popup.template == "view-line.html" && popup.scope.line.id == line.id) { + popup.close(); + if(popup.pos.lon == clickPos.lon && popup.pos.lat == clickPos.lat) + one = true; + } + }); + if(one) + return; + + if(!evt.ctrlKey && !evt.shiftKey) + map.popups.closeAll(); + + map.linesUi.viewLine(line, clickPos); + }); + return ret; }; } ]); diff --git a/frontend/js/fpMapMarkers.js b/frontend/js/fpMapMarkers.js index 2cc8d7f1..a932e263 100644 --- a/frontend/js/fpMapMarkers.js +++ b/frontend/js/fpMapMarkers.js @@ -106,10 +106,10 @@ } }; - map.mapEvents.$on("clickMarker", function(e, marker) { + map.mapEvents.$on("clickMarker", function(e, marker, evt) { var one = false; map.popups.getOpenPopups().forEach(function(popup) { - if(popup.scope.marker.id == marker.id) { + if(popup.template == "view-marker.html" && popup.scope.marker.id == marker.id) { popup.close(); one = true; } @@ -117,7 +117,9 @@ if(one) return; - map.popups.closeAll(); + if(!evt.ctrlKey && !evt.shiftKey) + map.popups.closeAll(); + ret.viewMarker(marker); }); diff --git a/frontend/js/fpMapPopups.js b/frontend/js/fpMapPopups.js index 85f71a67..2bf83347 100644 --- a/frontend/js/fpMapPopups.js +++ b/frontend/js/fpMapPopups.js @@ -33,7 +33,8 @@ this.pos = pos; _updatePosition(); }, - scope: scope + scope: scope, + template: template }; $('×').click(ret.close.bind(ret)).appendTo(el);