import '../../../assert/js/assert.js';
import '../../../globals.js';
/**
 * A PanZoomListener that supports additional forms of input for pan and zoom, including trackpad gestures, mouse
 * wheel, and keyboard input. These gestures will animate the target node to its destination translation and scale so it
 * uses a step function that must be called every animation frame.
 *
 * @author Jesse Greenberg
 */
import BooleanProperty from '../../../axon/js/BooleanProperty.js';
import Bounds2 from '../../../dot/js/Bounds2.js';
import Vector2 from '../../../dot/js/Vector2.js';
import { Focus, LimitPanDirection, MultiListenerPress, Node, PanZoomListener, PanZoomListenerOptions, SceneryEvent } from '../imports.js';
declare class AnimatedPanZoomListener extends PanZoomListener {
    private sourcePosition;
    private destinationPosition;
    private sourceScale;
    private destinationScale;
    private scaleGestureTargetPosition;
    private discreteScales;
    private middlePress;
    private _dragBounds;
    private _transformedPanBounds;
    private _draggingInDragBounds;
    private _attachedPointers;
    private boundsFinite;
    private gestureStartAction;
    private gestureChangeAction;
    private trackpadGestureStartScale;
    readonly animatingProperty: BooleanProperty;
    private _transformTracker;
    private _focusBoundsListener;
    private readonly disposeAnimatedPanZoomListener;
    /**
     * targetNode - Node to be transformed by this listener
     * {Object} [providedOptions]
     */
    constructor(targetNode: Node, providedOptions?: PanZoomListenerOptions);
    /**
     * Step the listener, supporting any animation as the target node is transformed to target position and scale.
     */
    step(dt: number): void;
    /**
     * Attach a MiddlePress for drag panning, if detected.
     */
    down(event: SceneryEvent): void;
    /**
     * If in a state where we are panning from a middle mouse press, exit that state.
     */
    private cancelMiddlePress;
    /**
     * Listener for the attached pointer on move. Only move if a middle press is not currently down.
     */
    protected movePress(press: MultiListenerPress): void;
    /**
     * Part of the Scenery listener API. Supports repositioning while dragging a more descendant level
     * Node under this listener. If the node and pointer are out of the dragBounds, we reposition to keep the Node
     * visible within dragBounds.
     *
     * (scenery-internal)
     */
    move(event: SceneryEvent): void;
    /**
     * This function returns the targetNode if there are attached pointers and an attachedPressListener during a drag event,
     * otherwise the function returns null.
     */
    private getTargetNodeDuringDrag;
    /**
     * Gets the Bounds2 in the global coordinate frame that we are going to try to keep in view during a drag
     * operation.
     */
    private getGlobalBoundsToViewDuringDrag;
    /**
     * During a drag of another Node that is a descendant of this listener's targetNode, reposition if the
     * node is out of dragBounds so that the Node is always within panBounds.
     */
    private repositionDuringDrag;
    /**
     * Stop panning during drag by clearing variables that are set to indicate and provide information for this work.
     * @param [event] - if not provided all are panning is cancelled and we assume interruption
     */
    private cancelPanningDuringDrag;
    /**
     * Scenery listener API. Cancel any drag and pan behavior for the Pointer on the event.
     *
     * (scenery-internal)
     */
    up(event: SceneryEvent): void;
    /**
     * Input listener for the 'wheel' event, part of the Scenery Input API.
     * (scenery-internal)
     */
    wheel(event: SceneryEvent): void;
    /**
     * Keydown listener for events outside of the PDOM. Attached as a listener to the body and driven by
     * Events rather than SceneryEvents. When we handle Events from within the PDOM we need the Pointer to
     * determine if attached. But from outside of the PDOM we know that there is no focus in the document and therfore
     * the PDOMPointer is not attached.
     */
    private windowKeydown;
    /**
     * For the Scenery listener API, handle a keydown event. This SceneryEvent will have been dispatched from
     * Input.dispatchEvent and so the Event target must be within the PDOM. In this case, we may
     * need to prevent translation if the PDOMPointer is attached.
     *
     * (scenery-internal)
     */
    keydown(event: SceneryEvent): void;
    /**
     * Handle a change of focus by immediately panning so that the focused Node is in view. Also sets up the
     * TransformTracker which will automatically keep the target in the viewport as it is animates, and a listener
     * on the focusPanTargetBoundsProperty (if provided) to handle Node other size or custom changes.
     */
    handleFocusChange(focus: Focus | null, previousFocus: Focus | null): void;
    /**
     * Handle zoom commands from a keyboard.
     */
    handleZoomCommands(domEvent: Event): void;
    /**
     * This is just for macOS Safari. Responds to trackpad input. Prevents default browser behavior and sets values
     * required for repositioning as user operates the track pad.
     */
    private handleGestureStartEvent;
    /**
     * This is just for macOS Safari. Responds to trackpad input. Prevends default browser behavior and
     * sets destination scale as user pinches on the trackpad.
     */
    private handleGestureChangeEvent;
    /**
     * Handle the down MiddlePress during animation. If we have a middle press we need to update position target.
     */
    private handleMiddlePress;
    /**
     * Translate and scale to a target point. The result of this function should make it appear that we are scaling
     * in or out of a particular point on the target node. This actually modifies the matrix of the target node. To
     * accomplish zooming into a particular point, we compute a matrix that would transform the target node from
     * the target point, then apply scale, then translate the target back to the target point.
     *
     * @param globalPoint - point to zoom in on, in the global coordinate frame
     * @param scaleDelta
     */
    private translateScaleToTarget;
    /**
     * Sets the translation and scale to a target point. Like translateScaleToTarget, but instead of taking a scaleDelta
     * it takes the final scale to be used for the target Nodes matrix.
     *
     * @param globalPoint - point to translate to in the global coordinate frame
     * @param scale - final scale for the transformation matrix
     */
    private setTranslationScaleToTarget;
    /**
     * Translate the target node in a direction specified by deltaVector.
     */
    private translateDelta;
    /**
     * Translate the targetNode from a local point to a target point. Both points should be in the global coordinate
     * frame.
     * @param initialPoint - in global coordinate frame, source position
     * @param targetPoint - in global coordinate frame, target position
     */
    translateToTarget(initialPoint: Vector2, targetPoint: Vector2): void;
    /**
     * Repositions the target node in response to keyboard input.
     */
    private repositionFromKeys;
    /**
     * Repositions the target node in response to wheel input. Wheel input can come from a mouse, trackpad, or
     * other. Aspects of the event are slightly different for each input source and this function tries to normalize
     * these differences.
     */
    private repositionFromWheel;
    /**
     * Upon any kind of reposition, update the source position and scale for the next update in animateToTargets.
     *
     * Note: This assumes that any kind of repositioning of the target node will eventually call correctReposition.
     */
    protected correctReposition(): void;
    /**
     * When a new press begins, stop any in progress animation.
     */
    protected addPress(press: MultiListenerPress): void;
    /**
     * When presses are removed, reset animation destinations.
     */
    protected removePress(press: MultiListenerPress): void;
    /**
     * Interrupt the listener. Cancels any active input and clears references upon interaction end.
     */
    interrupt(): void;
    /**
     * "Cancel" the listener, when input stops abnormally. Part of the scenery Input API.
     */
    cancel(): void;
    /**
     * Returns true if the Intent of the Pointer indicates that it will be used for dragging of some kind.
     */
    private hasDragIntent;
    /**
     * Pan to a provided Node, attempting to place the node in the center of the transformedPanBounds. It may not end
     * up exactly in the center since we have to make sure panBounds are completely filled with targetNode content.
     *
     * You can conditionally not pan to the center by setting panToCenter to false. Sometimes shifting the screen so
     * that the Node is at the center is too jarring.
     *
     * @param node - Node to pan to
     * @param panToCenter - If true, listener will pan so that the Node is at the center of the screen. Otherwise, just
     *                      until the Node is fully displayed in the viewport.
     * @param panDirection - if provided, we will only pan in the direction specified, null for all directions
     */
    panToNode(node: Node, panToCenter: boolean, panDirection?: LimitPanDirection | null): void;
    /**
     * Set the destination position to pan such that the provided globalBounds are totally visible within the panBounds.
     * This will never pan outside panBounds, if the provided globalBounds extend beyond them.
     *
     * If we are not using panToCenter and the globalBounds is larger than the screen size this function does nothing.
     * It doesn't make sense to try to keep the provided bounds entirely in view if they are larger than the availalable
     * view space.
     *
     * @param globalBounds - in global coordinate frame
     * @param panToCenter - if true, we will pan to the center of the provided bounds, otherwise we will pan
     *                                until all edges are on screen
     * @param panDirection - if provided, we will only pan in the direction specified, null for all directions
     */
    private keepBoundsInView;
    /**
     * Keep a trail in view by panning to it if it has bounds that are outside of the global panBounds.
     */
    private keepTrailInView;
    /**
     * @param dt - in seconds
     */
    private animateToTargets;
    /**
     * Stop any in-progress transformations of the target node by setting destinations to sources immediately.
     */
    private stopInProgressAnimation;
    /**
     * Sets the source and destination positions. Necessary because target or pan bounds may not be defined
     * upon construction. This can set those up when they are defined.
     */
    private initializePositions;
    /**
     * Set the containing panBounds and then make sure that the targetBounds fully fill the new panBounds. Updates
     * bounds that trigger panning during a drag operation.
     */
    setPanBounds(bounds: Bounds2): void;
    /**
     * Upon setting target bounds, re-set source and destination positions.
     */
    setTargetBounds(targetBounds: Bounds2): void;
    /**
     * Set the destination position. In animation, we will try move the targetNode until sourcePosition matches
     * this point. Destination is in the local coordinate frame of the target node.
     */
    private setDestinationPosition;
    /**
     * Set the destination scale for the target node. In animation, target node will be repositioned until source
     * scale matches destination scale.
     */
    private setDestinationScale;
    /**
     * Calculate the translation speed to animate from our sourcePosition to our targetPosition. Speed goes to zero
     * as the translationDistance gets smaller for smooth animation as we reach our destination position. This returns
     * a speed in the coordinate frame of the parent of this listener's target Node.
     */
    private getTranslationSpeed;
    /**
     * Reset all transformations on the target node, and reset destination targets to source values to prevent any
     * in progress animation.
     */
    resetTransform(): void;
    /**
     * Get the next discrete scale from the current scale. Will be one of the scales along the discreteScales list
     * and limited by the min and max scales assigned to this MultiPanZoomListener.
     *
     * @param zoomIn - direction of zoom change, positive if zooming in
     * @returns number
     */
    private getNextDiscreteScale;
    dispose(): void;
}
export default AnimatedPanZoomListener;
//# sourceMappingURL=AnimatedPanZoomListener.d.ts.map