/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
export class MarkupInteractionHandler {
    constructor(scalingOptions) {
        this.handlePointerDown = (event) => {
            this.handleInteractionAttempt(event);
        };
        this.handlePointerMove = (event) => {
            this.handleInteractionMove(event);
        };
        this.handlePointerUp = (event) => {
            window.removeEventListener('pointermove', this.handlePointerMove);
            window.removeEventListener('pointerup', this.handlePointerUp);
            this.handleInteractionEnd(event);
        };
        this.resizeObserver = new ResizeObserver(([entry]) => {
            this.elementBounds = this.computeBoundingRect();
        });
        this.scalingOptions = scalingOptions !== null && scalingOptions !== void 0 ? scalingOptions : {};
    }
    initialize(element) {
        this.element = element;
        this.elementBounds = this.computeBoundingRect();
        this.resizeObserver.observe(this.element);
        this.element.addEventListener('pointerdown', this.handlePointerDown);
    }
    dispose() {
        var _a;
        this.resizeObserver.disconnect();
        (_a = this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener('pointerdown', this.handlePointerDown);
        this.element = undefined;
    }
    updateScalingOptions(scalingOptions) {
        this.scalingOptions = {
            ...this.scalingOptions,
            ...scalingOptions,
        };
    }
    getScalingOptions() {
        return this.scalingOptions;
    }
    acceptInteraction() {
        window.addEventListener('pointermove', this.handlePointerMove);
        window.addEventListener('pointerup', this.handlePointerUp);
    }
}
//# sourceMappingURL=interactions.js.map
