No trackpad mode for constrained resolutions
This commit is contained in:
@@ -793,6 +793,13 @@ class View extends BaseObject {
|
|||||||
return this.constraints_;
|
return this.constraints_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {boolean} Resolution constraint is set
|
||||||
|
*/
|
||||||
|
getConstrainResolution() {
|
||||||
|
return this.options_.constrainResolution;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array<number>=} opt_hints Destination array.
|
* @param {Array<number>=} opt_hints Destination array.
|
||||||
* @return {Array<number>} Hint.
|
* @return {Array<number>} Hint.
|
||||||
|
|||||||
@@ -212,8 +212,8 @@ class MouseWheelZoom extends Interaction {
|
|||||||
Mode.WHEEL;
|
Mode.WHEEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mode_ === Mode.TRACKPAD) {
|
const view = map.getView();
|
||||||
const view = map.getView();
|
if (this.mode_ === Mode.TRACKPAD && !view.getConstrainResolution()) {
|
||||||
if (this.trackpadTimeoutId_) {
|
if (this.trackpadTimeoutId_) {
|
||||||
clearTimeout(this.trackpadTimeoutId_);
|
clearTimeout(this.trackpadTimeoutId_);
|
||||||
} else {
|
} else {
|
||||||
@@ -248,9 +248,7 @@ class MouseWheelZoom extends Interaction {
|
|||||||
view.cancelAnimations();
|
view.cancelAnimations();
|
||||||
}
|
}
|
||||||
let delta = -clamp(this.totalDelta_, -this.maxDelta_ * this.deltaPerZoom_, this.maxDelta_ * this.deltaPerZoom_) / this.deltaPerZoom_;
|
let delta = -clamp(this.totalDelta_, -this.maxDelta_ * this.deltaPerZoom_, this.maxDelta_ * this.deltaPerZoom_) / this.deltaPerZoom_;
|
||||||
const currentZoom = view.getZoom();
|
if (view.getConstrainResolution()) {
|
||||||
const newZoom = view.getConstrainedZoom(currentZoom + delta);
|
|
||||||
if (currentZoom === newZoom) {
|
|
||||||
// view has a zoom constraint, zoom by 1
|
// view has a zoom constraint, zoom by 1
|
||||||
delta = delta ? delta > 0 ? 1 : -1 : 0;
|
delta = delta ? delta > 0 ? 1 : -1 : 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user