2018-11-09 20:40:51 +00:00
|
|
|
import './styles.css';
|
|
|
|
interface ChangeOptions {
|
|
|
|
/**
|
|
|
|
* Fire a 'change' event if values are different to current values
|
|
|
|
*/
|
|
|
|
allowChangeEvent?: boolean;
|
|
|
|
}
|
|
|
|
interface SetTransformOpts extends ChangeOptions {
|
|
|
|
scale?: number;
|
|
|
|
x?: number;
|
|
|
|
y?: number;
|
|
|
|
}
|
2023-01-02 15:10:29 +00:00
|
|
|
type ScaleRelativeToValues = 'container' | 'content';
|
|
|
|
type ReachMinScaleStrategy = 'reset' | 'none';
|
2018-11-09 20:40:51 +00:00
|
|
|
export interface ScaleToOpts extends ChangeOptions {
|
|
|
|
/** Transform origin. Can be a number, or string percent, eg "50%" */
|
|
|
|
originX?: number | string;
|
|
|
|
/** Transform origin. Can be a number, or string percent, eg "50%" */
|
|
|
|
originY?: number | string;
|
|
|
|
/** Should the transform origin be relative to the container, or content? */
|
|
|
|
relativeTo?: ScaleRelativeToValues;
|
|
|
|
}
|
|
|
|
export default class PinchZoom extends HTMLElement {
|
|
|
|
private _positioningEl?;
|
|
|
|
private _transform;
|
2023-01-02 15:10:29 +00:00
|
|
|
static get observedAttributes(): string[];
|
2018-11-09 20:40:51 +00:00
|
|
|
constructor();
|
2019-01-16 13:18:09 +00:00
|
|
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
2023-01-02 15:10:29 +00:00
|
|
|
get minScale(): number;
|
|
|
|
set minScale(value: number);
|
|
|
|
get reachMinScaleStrategy(): ReachMinScaleStrategy;
|
|
|
|
set reachMinScaleStrategy(value: ReachMinScaleStrategy);
|
|
|
|
get allowPanMinScale(): number;
|
|
|
|
set allowPanMinScale(value: number);
|
|
|
|
get resetToMinScaleLimit(): number;
|
|
|
|
set resetToMinScaleLimit(value: number);
|
|
|
|
get stopPropagateHandled(): boolean;
|
|
|
|
set stopPropagateHandled(value: boolean);
|
2018-11-09 20:40:51 +00:00
|
|
|
connectedCallback(): void;
|
2023-01-02 15:10:29 +00:00
|
|
|
get x(): number;
|
|
|
|
get y(): number;
|
|
|
|
get scale(): number;
|
2018-11-09 20:40:51 +00:00
|
|
|
/**
|
|
|
|
* Change the scale, adjusting x/y by a given transform origin.
|
|
|
|
*/
|
|
|
|
scaleTo(scale: number, opts?: ScaleToOpts): void;
|
|
|
|
/**
|
|
|
|
* Update the stage with a given scale/x/y.
|
|
|
|
*/
|
|
|
|
setTransform(opts?: SetTransformOpts): void;
|
|
|
|
/**
|
|
|
|
* Update transform values without checking bounds. This is only called in setTransform.
|
|
|
|
*/
|
|
|
|
private _updateTransform;
|
|
|
|
/**
|
|
|
|
* Called when the direct children of this element change.
|
|
|
|
* Until we have have shadow dom support across the board, we
|
|
|
|
* require a single element to be the child of <pinch-zoom>, and
|
|
|
|
* that's the element we pan/scale.
|
|
|
|
*/
|
|
|
|
private _stageElChange;
|
|
|
|
private _onWheel;
|
|
|
|
private _onPointerMove;
|
2021-08-02 20:48:32 +00:00
|
|
|
private _maybeResetScale;
|
|
|
|
private _onPointerEnd;
|
|
|
|
private _resetToMinScale;
|
2018-11-09 20:40:51 +00:00
|
|
|
/** Transform the view & fire a change event */
|
|
|
|
private _applyChange;
|
2021-08-02 20:48:32 +00:00
|
|
|
private _maybeStopPropagate;
|
|
|
|
private _allowPan;
|
|
|
|
private _maybeEmitCancel;
|
2021-08-03 00:58:32 +00:00
|
|
|
private _onClick;
|
2018-11-09 20:40:51 +00:00
|
|
|
}
|
|
|
|
export {};
|