mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 14:38:05 +02:00
Begin d3 v4 update
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { d3keybinding } from '../../js/lib/d3.keybinding.js';
|
||||
import * as d3 from 'd3';
|
||||
import { Debug, Gpx } from '../svg/index';
|
||||
import { RawMercator } from '../geo/index';
|
||||
import { TileLayer } from '../renderer/index';
|
||||
import { setTransform } from '../util/index';
|
||||
import { getDimensions, setDimensions } from '../util/dimensions';
|
||||
|
||||
export function MapInMap(context) {
|
||||
var key = '/';
|
||||
@@ -12,7 +15,7 @@ export function MapInMap(context) {
|
||||
projection = RawMercator(),
|
||||
gpxLayer = Gpx(projection, context).showLabels(false),
|
||||
debugLayer = Debug(projection, context),
|
||||
zoom = d3.behavior.zoom()
|
||||
zoom = d3.zoom()
|
||||
.scaleExtent([ztok(0.5), ztok(24)])
|
||||
.on('zoom', zoomPan),
|
||||
transformed = false,
|
||||
@@ -75,7 +78,7 @@ export function MapInMap(context) {
|
||||
panning = false;
|
||||
|
||||
if (tCurr[0] !== tStart[0] && tCurr[1] !== tStart[1]) {
|
||||
var dMini = wrap.dimensions(),
|
||||
var dMini = getDimensions(wrap),
|
||||
cMini = [ dMini[0] / 2, dMini[1] / 2 ];
|
||||
|
||||
context.map().center(projection.invert(cMini));
|
||||
@@ -85,7 +88,7 @@ export function MapInMap(context) {
|
||||
|
||||
function updateProjection() {
|
||||
var loc = context.map().center(),
|
||||
dMini = wrap.dimensions(),
|
||||
dMini = getDimensions(wrap),
|
||||
cMini = [ dMini[0] / 2, dMini[1] / 2 ],
|
||||
tMain = context.projection.translate(),
|
||||
kMain = context.projection.scale(),
|
||||
@@ -129,7 +132,7 @@ export function MapInMap(context) {
|
||||
|
||||
updateProjection();
|
||||
|
||||
var dMini = wrap.dimensions(),
|
||||
var dMini = getDimensions(wrap),
|
||||
zMini = ktoz(projection.scale() * 2 * Math.PI);
|
||||
|
||||
// setup tile container
|
||||
@@ -212,7 +215,7 @@ export function MapInMap(context) {
|
||||
|
||||
// redraw viewport bounding box
|
||||
if (!panning) {
|
||||
var getPath = d3.geo.path().projection(projection),
|
||||
var getPath = d3.geoPath().projection(projection),
|
||||
bbox = { type: 'Polygon', coordinates: [context.map().extent().polygon()] };
|
||||
|
||||
viewport = wrap.selectAll('.map-in-map-viewport')
|
||||
@@ -294,7 +297,7 @@ export function MapInMap(context) {
|
||||
|
||||
redraw();
|
||||
|
||||
var keybinding = d3.keybinding('map-in-map')
|
||||
var keybinding = d3keybinding('map-in-map')
|
||||
.on(key, toggle);
|
||||
|
||||
d3.select(document)
|
||||
|
||||
Reference in New Issue
Block a user