mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 07:25:15 +02:00
@@ -150,7 +150,7 @@ export function uiCommitChanges(context) {
|
||||
} else {
|
||||
var entity = change.entity;
|
||||
_entityID = change.entity.id;
|
||||
context.map().zoomTo(entity);
|
||||
context.map().zoomToEase(entity);
|
||||
context.surface().selectAll(utilEntityOrMemberSelector([_entityID], context.graph()))
|
||||
.classed('hover', true);
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ export function uiConflicts(context) {
|
||||
if (extent) {
|
||||
context.map().trimmedExtent(extent);
|
||||
} else {
|
||||
context.map().zoomTo(entity);
|
||||
context.map().zoomToEase(entity);
|
||||
}
|
||||
context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph()))
|
||||
.classed('hover', true);
|
||||
|
||||
@@ -316,7 +316,7 @@ export function uiFeatureList(context) {
|
||||
function click(d) {
|
||||
d3_event.preventDefault();
|
||||
if (d.location) {
|
||||
context.map().centerZoom([d.location[1], d.location[0]], 19);
|
||||
context.map().centerZoomEase([d.location[1], d.location[0]], 19);
|
||||
}
|
||||
else if (d.entity) {
|
||||
if (d.entity.type === 'node') {
|
||||
|
||||
+15
-16
@@ -7,19 +7,19 @@ import { uiLoading } from './loading';
|
||||
|
||||
|
||||
export function uiGeolocate(context) {
|
||||
var geoOptions = { enableHighAccuracy: false, timeout: 6000 /* 6sec */ },
|
||||
locating = uiLoading(context).message(t('geolocate.locating')).blocking(true),
|
||||
layer = context.layers().layer('geolocate'),
|
||||
position,
|
||||
extent,
|
||||
timeoutId;
|
||||
var geoOptions = { enableHighAccuracy: false, timeout: 6000 /* 6sec */ };
|
||||
var locating = uiLoading(context).message(t('geolocate.locating')).blocking(true);
|
||||
var layer = context.layers().layer('geolocate');
|
||||
var _position;
|
||||
var _extent;
|
||||
var _timeoutID;
|
||||
|
||||
|
||||
function click() {
|
||||
if (context.inIntro()) return;
|
||||
context.enter(modeBrowse(context));
|
||||
if (!layer.enabled()) {
|
||||
if (!position) {
|
||||
if (!_position) {
|
||||
context.container().call(locating);
|
||||
navigator.geolocation.getCurrentPosition(success, error, geoOptions);
|
||||
} else {
|
||||
@@ -30,21 +30,20 @@ export function uiGeolocate(context) {
|
||||
}
|
||||
// This timeout ensures that we still call finish() even if
|
||||
// the user declines to share their location in Firefox
|
||||
timeoutId = setTimeout(finish, 10000 /* 10sec */ );
|
||||
_timeoutID = setTimeout(finish, 10000 /* 10sec */ );
|
||||
}
|
||||
|
||||
function zoomTo() {
|
||||
var map = context.map();
|
||||
layer.enabled(position, true);
|
||||
map.centerZoom(extent.center(), Math.min(20, map.extentZoom(extent)));
|
||||
layer.enabled(_position, true);
|
||||
map.centerZoomEase(_extent.center(), Math.min(20, map.extentZoom(_extent)));
|
||||
}
|
||||
|
||||
|
||||
function success(geolocation) {
|
||||
position = geolocation;
|
||||
extent = geoExtent([position.coords.longitude, position.coords.latitude])
|
||||
.padByMeters(position.coords.accuracy);
|
||||
|
||||
_position = geolocation;
|
||||
var coords = _position.coords;
|
||||
_extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
|
||||
zoomTo();
|
||||
finish();
|
||||
}
|
||||
@@ -57,8 +56,8 @@ export function uiGeolocate(context) {
|
||||
|
||||
function finish() {
|
||||
locating.close(); // unblock ui
|
||||
if (timeoutId) { clearTimeout(timeoutId); }
|
||||
timeoutId = undefined;
|
||||
if (_timeoutID) { clearTimeout(_timeoutID); }
|
||||
_timeoutID = undefined;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ export function uiKeepRightDetails(context) {
|
||||
osmlayer.enabled(true);
|
||||
}
|
||||
|
||||
context.map().centerZoom(_error.loc, 20);
|
||||
context.map().centerZoomEase(_error.loc, 20);
|
||||
|
||||
if (entity) {
|
||||
context.enter(modeSelect(context, [entityID]));
|
||||
|
||||
@@ -51,7 +51,7 @@ export function uiRawMemberEditor(context) {
|
||||
var mapExtent = context.map().extent();
|
||||
if (!entity.intersects(mapExtent, context.graph())) {
|
||||
// zoom to the entity if its extent is not visible now
|
||||
context.map().zoomTo(entity);
|
||||
context.map().zoomToEase(entity);
|
||||
}
|
||||
|
||||
context.enter(modeSelect(context, [d.id]));
|
||||
|
||||
Reference in New Issue
Block a user