opening josm will only load the current view if you are close enough,
opening josm will no longer trigger a constant loading symbol in browsers
This commit is contained in:
parent
94ca30c690
commit
369edbe9a7
@ -43,6 +43,14 @@ OSRM.MapView = L.Map.extend({
|
|||||||
bounds.extend( this.unproject(ne_point,zoom) );
|
bounds.extend( this.unproject(ne_point,zoom) );
|
||||||
this.fitBounds( bounds );
|
this.fitBounds( bounds );
|
||||||
},
|
},
|
||||||
|
getBoundsUI: function(unbounded) {
|
||||||
|
var bounds = this.getPixelBounds();
|
||||||
|
if( OSRM.GUI.visible == true )
|
||||||
|
bounds.min.x+=OSRM.GUI.width;
|
||||||
|
var sw = this.unproject(new L.Point(bounds.min.x, bounds.max.y), this._zoom, true),
|
||||||
|
ne = this.unproject(new L.Point(bounds.max.x, bounds.min.y), this._zoom, true);
|
||||||
|
return new L.LatLngBounds(sw, ne);
|
||||||
|
},
|
||||||
getCenterUI: function(unbounded) {
|
getCenterUI: function(unbounded) {
|
||||||
var viewHalf = this.getSize();
|
var viewHalf = this.getSize();
|
||||||
if( OSRM.GUI.visible == true )
|
if( OSRM.GUI.visible == true )
|
||||||
|
@ -78,16 +78,22 @@ inputChanged: function(marker_id) {
|
|||||||
|
|
||||||
// click: button "open JOSM"
|
// click: button "open JOSM"
|
||||||
openJOSM: function() {
|
openJOSM: function() {
|
||||||
var x = OSRM.G.map.getCenterUI();
|
var center = OSRM.G.map.getCenterUI();
|
||||||
var ydelta = 0.01;
|
var bounds = OSRM.G.map.getBoundsUI();
|
||||||
var xdelta = ydelta * 2;
|
|
||||||
var p = [ 'left=' + (x.lng - xdelta), 'bottom=' + (x.lat - ydelta), 'right=' + (x.lng + xdelta), 'top=' + (x.lat + ydelta)];
|
|
||||||
var url = 'http://localhost:8111/load_and_zoom?' + p.join('&');
|
|
||||||
|
|
||||||
var frame = L.DomUtil.create('iframe', null, document.body);
|
var xdelta = Math.min(0.02, Math.abs(bounds.getSouthWest().lng - center.lng) );
|
||||||
frame.style.width = frame.style.height = "0px";
|
var ydelta = Math.min(0.01, Math.abs(bounds.getSouthWest().lat - center.lat) );
|
||||||
|
|
||||||
|
var p = [ 'left=' + (center.lng - xdelta), 'bottom=' + (center.lat - ydelta), 'right=' + (center.lng + xdelta), 'top=' + (center.lat + ydelta)];
|
||||||
|
var url = 'http://127.0.0.1:8111/load_and_zoom?' + p.join('&');
|
||||||
|
|
||||||
|
var frame = document.getElementById('josm-frame');
|
||||||
|
if(!frame) {
|
||||||
|
frame = L.DomUtil.create('iframe', null, document.body);
|
||||||
|
frame.style.display = "none";
|
||||||
|
frame.id = 'josm-frame';
|
||||||
|
}
|
||||||
frame.src = url;
|
frame.src = url;
|
||||||
frame.onload = function(e) { document.body.removeChild(frame); };
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//click: button "open OSM Bugs"
|
//click: button "open OSM Bugs"
|
||||||
@ -111,4 +117,4 @@ deleteMarker: function(marker_id) {
|
|||||||
OSRM.G.markers.highlight.hide();
|
OSRM.G.markers.highlight.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user