kopia lustrzana https://github.com/FacilMap/facilmap
Add links to view the current view on external maps
rodzic
3deb8f2e3b
commit
d76d14950e
|
@ -24,7 +24,7 @@
|
|||
</ul></li>
|
||||
<li role="presentation" uib-dropdown keyboard-nav="true">
|
||||
<a href="javascript:" id="toolbox-layers-dropdown" uib-dropdown-toggle role="button">Map style <span class="caret"></span></a>
|
||||
<ul uib-dropdown-menu aria-labelledby="toolbox-layers-dropdown">
|
||||
<ul uib-dropdown-menu aria-labelledby="toolbox-layers-dropdown" class="dropdown-menu-right">
|
||||
<li ng-repeat="layer in layers.base" ng-class="{active: layer.visibility}">
|
||||
<a href="javascript:" ng-click="setLayer(layer)">{{layer.name}}</a>
|
||||
</li>
|
||||
|
@ -32,6 +32,10 @@
|
|||
<li ng-repeat="layer in layers.overlay" ng-class="{active: layer.visibility}">
|
||||
<a href="javascript:" ng-click="setLayer(layer)">{{layer.name}}</a>
|
||||
</li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li><a href="{{links.osm}}" target="_blank">Open this on OpenStreetMap</a></li>
|
||||
<li><a href="{{links.google}}" target="_blank">Open this on Google Maps</a></li>
|
||||
<li><a href="{{links.bing}}" target="_blank">Open this on Bing Maps</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li role="presentation" uib-dropdown keyboard-nav="true">
|
||||
|
|
|
@ -5,6 +5,21 @@ fm.app.factory("fmMapToolbox", function($compile, fmFilter) {
|
|||
return function(map) {
|
||||
var scope = map.socket.$new();
|
||||
|
||||
scope.links = {};
|
||||
function updateLinks() {
|
||||
if(!map.map._loaded)
|
||||
return;
|
||||
|
||||
let center = map.map.getCenter();
|
||||
let zoom = map.map.getZoom();
|
||||
|
||||
scope.links.osm = `https://www.openstreetmap.org/#map=${zoom}/${center.lat}/${center.lng}`;
|
||||
scope.links.google = `https://www.google.com/maps/@${center.lat},${center.lng},${zoom}z`;
|
||||
scope.links.bing = `https://www.bing.com/maps?cp=${center.lat}~${center.lng}&lvl=${zoom}`;
|
||||
}
|
||||
updateLinks();
|
||||
map.map.on("moveend", updateLinks);
|
||||
|
||||
scope.addObject = function(type) {
|
||||
if(type.type == "marker")
|
||||
map.markersUi.addMarker(type);
|
||||
|
|
Ładowanie…
Reference in New Issue