mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-31 20:21:36 +02:00
Convert lodah-es and d3 to named imports for behaviors
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
import * as d3 from 'd3';
|
||||
import _ from 'lodash';
|
||||
import _assign from 'lodash-es/assign';
|
||||
import _omit from 'lodash-es/omit';
|
||||
import _throttle from 'lodash-es/throttle';
|
||||
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { geoSphericalDistance } from '../geo';
|
||||
import { modeBrowse } from '../modes';
|
||||
import { utilQsString, utilStringQs } from '../util';
|
||||
|
||||
import {
|
||||
utilQsString,
|
||||
utilStringQs
|
||||
} from '../util';
|
||||
|
||||
|
||||
export function behaviorHash(context) {
|
||||
@@ -37,7 +45,7 @@ export function behaviorHash(context) {
|
||||
var center = map.center(),
|
||||
zoom = map.zoom(),
|
||||
precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)),
|
||||
q = _.omit(utilStringQs(window.location.hash.substring(1)),
|
||||
q = _omit(utilStringQs(window.location.hash.substring(1)),
|
||||
['comment', 'hashtags', 'walkthrough']
|
||||
),
|
||||
newParams = {};
|
||||
@@ -54,7 +62,7 @@ export function behaviorHash(context) {
|
||||
'/' + center[1].toFixed(precision) +
|
||||
'/' + center[0].toFixed(precision);
|
||||
|
||||
return '#' + utilQsString(_.assign(q, newParams), true);
|
||||
return '#' + utilQsString(_assign(q, newParams), true);
|
||||
};
|
||||
|
||||
|
||||
@@ -67,7 +75,7 @@ export function behaviorHash(context) {
|
||||
}
|
||||
|
||||
|
||||
var throttledUpdate = _.throttle(update, 500);
|
||||
var throttledUpdate = _throttle(update, 500);
|
||||
|
||||
|
||||
function hashchange() {
|
||||
@@ -85,7 +93,7 @@ export function behaviorHash(context) {
|
||||
context
|
||||
.on('enter.hash', throttledUpdate);
|
||||
|
||||
d3.select(window)
|
||||
d3_select(window)
|
||||
.on('hashchange.hash', hashchange);
|
||||
|
||||
if (window.location.hash) {
|
||||
@@ -127,7 +135,7 @@ export function behaviorHash(context) {
|
||||
context
|
||||
.on('enter.hash', null);
|
||||
|
||||
d3.select(window)
|
||||
d3_select(window)
|
||||
.on('hashchange.hash', null);
|
||||
|
||||
window.location.hash = '';
|
||||
|
||||
Reference in New Issue
Block a user