|
|
@ -321,6 +321,7 @@ export function attachTouch(element, options = {}) {
|
|
|
|
* @prop {number=} minScale
|
|
|
|
* @prop {number=} minScale
|
|
|
|
* @prop {number=} maxScale
|
|
|
|
* @prop {number=} maxScale
|
|
|
|
* @prop {number=} scale Defaults to 1
|
|
|
|
* @prop {number=} scale Defaults to 1
|
|
|
|
|
|
|
|
* @prop {boolean=} round Whether or not to round `dx` and `dy` in `getState`
|
|
|
|
**/
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -344,6 +345,9 @@ export class Pannable {
|
|
|
|
|
|
|
|
|
|
|
|
/** @private **/
|
|
|
|
/** @private **/
|
|
|
|
this.lastValues = [0, 0, 1];
|
|
|
|
this.lastValues = [0, 0, 1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @private **/
|
|
|
|
|
|
|
|
this.round = options.round;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** @private **/
|
|
|
|
/** @private **/
|
|
|
@ -381,7 +385,15 @@ export class Pannable {
|
|
|
|
|
|
|
|
|
|
|
|
/** @returns {PannableState} **/
|
|
|
|
/** @returns {PannableState} **/
|
|
|
|
getState(cx = 0, cy = 0) {
|
|
|
|
getState(cx = 0, cy = 0) {
|
|
|
|
return new PannableState(this.dx + cx, this.dy + cy, this.logScale);
|
|
|
|
if (this.round) {
|
|
|
|
|
|
|
|
return new PannableState(
|
|
|
|
|
|
|
|
Math.round(this.dx + cx),
|
|
|
|
|
|
|
|
Math.round(this.dy + cy),
|
|
|
|
|
|
|
|
this.logScale
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return new PannableState(this.dx + cx, this.dy + cy, this.logScale);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|