[WIP] GPX Layer is added to the mini-map.

This commit is contained in:
Denys Digtiar
2015-06-13 15:27:24 +10:00
parent 304ac66c5f
commit ba4312ed80
2 changed files with 20 additions and 9 deletions

View File

@@ -2136,8 +2136,11 @@ img.wiki-image {
user-select: none;
}
.map-in-map-svg {
position: relative;
.map-in-map-svg,
.map-in-map-gpx {
position: absolute;
top: 0;
left: 0;
overflow: hidden;
height: 100%;
width: 100%;

View File

@@ -3,8 +3,7 @@ iD.ui.MapInMap = function(context) {
function map_in_map(selection) {
var backgroundLayer = iD.TileLayer(),
gpxLayer = iD.GpxLayer(context)
.projection(context.projection),
gpxLayer = iD.GpxLayer(context),
overlayLayer = iD.TileLayer(),
projection = iD.geo.RawMercator(),
zoom = d3.behavior.zoom()
@@ -153,10 +152,6 @@ iD.ui.MapInMap = function(context) {
background
.call(backgroundLayer);
// Add the gpxLayer _somewhere_ here
// background
// .call(gpxLayer)
// redraw overlay
var overlaySources = context.background().overlayLayerSources(),
hasOverlay = false;
@@ -189,6 +184,20 @@ iD.ui.MapInMap = function(context) {
.call(overlayLayer);
}
gpxLayer
.projection(projection);
var gpx = tiles
.selectAll('.map-in-map-gpx')
.data([0]);
gpx.enter()
.append('div')
.attr('class', 'map-in-map-gpx');
gpx.call(gpxLayer);
gpx.dimensions(dMini);
// redraw bounding box
if (!panning) {
var getPath = d3.geo.path().projection(projection),
@@ -275,7 +284,6 @@ iD.ui.MapInMap = function(context) {
if (gpx) {
d3.text(gpx, function(err, gpxTxt) {
gpxLayer.geojson(toGeoJSON.gpx(toDom(gpxTxt)));
console.log(gpxTxt)
queueRedraw();
});
}