import { noop } from '@blockeditor/global/utils';
import { EdgelessToolController } from './index.js';
export class PanToolController extends EdgelessToolController {
    constructor() {
        super(...arguments);
        this.tool = {
            type: 'pan',
        };
        this._lastPoint = null;
    }
    onContainerClick() {
        noop();
    }
    onContainerContextMenu() {
        noop();
    }
    onContainerPointerDown() {
        noop();
    }
    onContainerDblClick() {
        noop();
    }
    onContainerTripleClick() {
        noop();
    }
    onContainerDragStart(e) {
        this._lastPoint = [e.x, e.y];
        this._edgeless.slots.edgelessToolUpdated.emit({
            type: 'pan',
            panning: true,
        });
    }
    onContainerDragMove(e) {
        if (!this._lastPoint)
            return;
        const { viewport } = this._edgeless.surface;
        const { zoom } = viewport;
        const [lastX, lastY] = this._lastPoint;
        const deltaX = lastX - e.x;
        const deltaY = lastY - e.y;
        this._lastPoint = [e.x, e.y];
        viewport.applyDeltaCenter(deltaX / zoom, deltaY / zoom);
    }
    onContainerDragEnd() {
        this._lastPoint = null;
        this._edgeless.slots.edgelessToolUpdated.emit({
            type: 'pan',
            panning: false,
        });
    }
    onContainerMouseMove() {
        noop();
    }
    onContainerMouseOut() {
        noop();
    }
    onPressShiftKey(_) {
        noop();
    }
    beforeModeSwitch() {
        noop();
    }
    afterModeSwitch() {
        noop();
    }
}
//# sourceMappingURL=pan-tool.js.map