Disallow zooming past the min/max zoom bounds via scrolling or pinch-to-zoom (close #6851)

This commit is contained in:
Quincy Morgan
2019-09-19 16:27:51 -04:00
parent 6af6da6fc0
commit c2a49f4e02

View File

@@ -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