mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Disallow zooming past the min/max zoom bounds via scrolling or pinch-to-zoom (close #6851)
This commit is contained in:
@@ -426,6 +426,7 @@ export function rendererMap(context) {
|
||||
p0 = _getMouseCoords(source);
|
||||
p1 = t0.invert(p0);
|
||||
k2 = t0.k * Math.pow(2, -dY / 500);
|
||||
k2 = clamp(k2, kMin, kMax);
|
||||
x2 = p0[0] - p1[0] * k2;
|
||||
y2 = p0[1] - p1[1] * k2;
|
||||
|
||||
@@ -437,6 +438,7 @@ export function rendererMap(context) {
|
||||
p0 = _getMouseCoords(source);
|
||||
p1 = t0.invert(p0);
|
||||
k2 = t0.k * source._scale;
|
||||
k2 = clamp(k2, kMin, kMax);
|
||||
x2 = p0[0] - p1[0] * k2;
|
||||
y2 = p0[1] - p1[1] * k2;
|
||||
|
||||
@@ -452,6 +454,7 @@ export function rendererMap(context) {
|
||||
p0 = _getMouseCoords(source);
|
||||
p1 = t0.invert(p0);
|
||||
k2 = t0.k * Math.pow(2, -dY / 500);
|
||||
k2 = clamp(k2, kMin, kMax);
|
||||
x2 = p0[0] - p1[0] * k2;
|
||||
y2 = p0[1] - p1[1] * k2;
|
||||
|
||||
@@ -462,6 +465,7 @@ export function rendererMap(context) {
|
||||
p0 = _getMouseCoords(source);
|
||||
p1 = t0.invert(p0);
|
||||
k2 = t0.k * Math.pow(2, -dY / 500);
|
||||
k2 = clamp(k2, kMin, kMax);
|
||||
x2 = p0[0] - p1[0] * k2;
|
||||
y2 = p0[1] - p1[1] * k2;
|
||||
|
||||
@@ -474,6 +478,7 @@ export function rendererMap(context) {
|
||||
x2 = p1[0] - dX;
|
||||
y2 = p1[1] - dY;
|
||||
k2 = projection.scale();
|
||||
k2 = clamp(k2, kMin, kMax);
|
||||
}
|
||||
|
||||
// something changed - replace the event transform
|
||||
|
||||
Reference in New Issue
Block a user