var typeMap = {
    touch: {
        pointerdown: "touchstart",
        pointermove: "touchmove",
        pointerup: "touchend"
    },
    mouse: {
        pointerdown: "mousedown",
        pointermove: "mousemove",
        pointerup: "mouseup"
    }
};
var Orbiter = /** @class */ (function () {
    function Orbiter(touchCollection, getOrbitControls) {
        this.touchCollection = touchCollection;
        this.getOrbitControls = getOrbitControls;
        this.name = "orbit";
    }
    Orbiter.prototype.onPointerDown = function (event) {
        return this.handleOrbiterEvent(event);
    };
    Orbiter.prototype.onPointerMove = function (event) {
        return this.handleOrbiterEvent(event);
    };
    Orbiter.prototype.onPointerUp = function (event) {
        return this.handleOrbiterEvent(event, "pointerup");
    };
    Orbiter.prototype.handleOrbiterEvent = function (event, eventType) {
        if (eventType === void 0) { eventType = event.type; }
        var pointerType = event.pointerType;
        var methodName = typeMap[pointerType][eventType];
        var controls = this.getOrbitControls();
        if (pointerType === "touch") {
            var fakeTouch = this.touchCollection.buildFakeTouchEvent(event);
            return controls[methodName](fakeTouch);
        }
        return controls[methodName](event);
    };
    return Orbiter;
}());
export { Orbiter };
