mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 22:48:10 +02:00
Moved minimap gpx layer methods to the background gpx layer handlers
This commit is contained in:
@@ -142,6 +142,7 @@ iD.Background = function(context) {
|
||||
|
||||
reader.onload = function(e) {
|
||||
gpxLayer.geojson(toGeoJSON.gpx(toDom(e.target.result)));
|
||||
iD.ui.MapInMap.gpxLayer.geojson(toGeoJSON.gpx(toDom(e.target.result)));
|
||||
background.zoomToGpxLayer();
|
||||
dispatch.change();
|
||||
};
|
||||
@@ -167,6 +168,7 @@ iD.Background = function(context) {
|
||||
|
||||
background.toggleGpxLayer = function() {
|
||||
gpxLayer.enable(!gpxLayer.enable());
|
||||
iD.ui.MapInMap.gpxLayer.enable(!iD.ui.MapInMap.gpxLayer.enable());
|
||||
dispatch.change();
|
||||
};
|
||||
|
||||
@@ -263,6 +265,7 @@ iD.Background = function(context) {
|
||||
if (gpx) {
|
||||
d3.text(gpx, function(err, gpxTxt) {
|
||||
gpxLayer.geojson(toGeoJSON.gpx(toDom(gpxTxt)));
|
||||
iD.ui.MapInMap.gpxLayer.geojson(toGeoJSON.gpx(toDom(gpxTxt)));
|
||||
dispatch.change();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -255,9 +255,9 @@ iD.ui.Background = function(context) {
|
||||
var controls = content.append('div')
|
||||
.attr('class', 'controls-list');
|
||||
|
||||
var label = controls.append('label');
|
||||
var minimapLabel = controls.append('label');
|
||||
|
||||
label.classed('minimap-toggle', true)
|
||||
minimapLabel.classed('minimap-toggle', true)
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function() {
|
||||
@@ -267,7 +267,7 @@ iD.ui.Background = function(context) {
|
||||
d3.event.preventDefault();
|
||||
});
|
||||
|
||||
label.append('span')
|
||||
minimapLabel.append('span')
|
||||
.text(t('background.toggle_minimap'));
|
||||
|
||||
var adjustments = content.append('div')
|
||||
|
||||
+5
-13
@@ -2,8 +2,10 @@ iD.ui.MapInMap = function(context) {
|
||||
var key = '/';
|
||||
|
||||
function map_in_map(selection) {
|
||||
|
||||
var backgroundLayer = iD.TileLayer(),
|
||||
gpxLayer = iD.GpxLayer(context),
|
||||
dispatch = d3.dispatch('change'),
|
||||
gpxLayer = iD.GpxLayer(context, dispatch),
|
||||
overlayLayer = iD.TileLayer(),
|
||||
projection = iD.geo.RawMercator(),
|
||||
zoom = d3.behavior.zoom()
|
||||
@@ -14,6 +16,8 @@ iD.ui.MapInMap = function(context) {
|
||||
zDiff = 6, // by default, minimap renders at (main zoom - 6)
|
||||
tStart, tLast, tCurr, kLast, kCurr, tiles, svg, gpx, timeoutId;
|
||||
|
||||
iD.ui.MapInMap.gpxLayer = gpxLayer;
|
||||
|
||||
function ztok(z) { return 256 * Math.pow(2, z); }
|
||||
function ktoz(k) { return Math.log(k) / Math.LN2 - 8; }
|
||||
|
||||
@@ -278,18 +282,6 @@ iD.ui.MapInMap = function(context) {
|
||||
if (drawn.full === true) redraw();
|
||||
});
|
||||
|
||||
function toDom(x) {
|
||||
return (new DOMParser()).parseFromString(x, 'text/xml');
|
||||
}
|
||||
|
||||
var q = iD.util.stringQs(location.hash.substring(1));
|
||||
var gpx = q.gpx;
|
||||
if (gpx) {
|
||||
d3.text(gpx, function(err, gpxTxt) {
|
||||
gpxLayer.geojson(toGeoJSON.gpx(toDom(gpxTxt)));
|
||||
queueRedraw();
|
||||
});
|
||||
}
|
||||
redraw();
|
||||
|
||||
var keybinding = d3.keybinding('map-in-map')
|
||||
|
||||
Reference in New Issue
Block a user