import { ToolRepository } from "../../Tools";
import { makeRayPanScaleTransformUC, makeScaleTransformUC, makeStylusMoveTransformUC, makeTransform3DPM, PanScaleTransformSC, } from "../../Transform3D";
import { DoubleTapToFocus, MouseClickToFocus, MouseOrbit, MousePan, MouseRoll, MouseScale, SceneRootMoveSC, TouchOrbit, TouchPan, TouchPinch, TouchScale, } from "../Controllers";
import { makeSceneRootEntity } from "../Entities";
import { makeBumpSceneRootScaleAboutPixelPointUC, makeCenterSceneRootOnPixelPickUC, makeDragScaleSceneRootUC, makeFocusOnPixelUC, makeOrbitSceneRootUC, makePanSceneRootUC, makePinchSceneRootUC, makeSerializeSceneRoot, ScaleSceneRootWithRay, } from "../UC";
export function setupSceneRoot(appObjects, defaultData) {
    const ao = appObjects.getOrCreate("SceneRoot");
    const entity = makeSceneRootEntity(ao);
    if (defaultData) {
        entity.applyDefaultData(defaultData);
    }
    // UCs
    makeBumpSceneRootScaleAboutPixelPointUC(ao);
    makeCenterSceneRootOnPixelPickUC(ao);
    makeDragScaleSceneRootUC(ao);
    makeFocusOnPixelUC(ao);
    makeOrbitSceneRootUC(ao);
    makePanSceneRootUC(ao);
    makePinchSceneRootUC(ao);
    new ScaleSceneRootWithRay(ao);
    makeSerializeSceneRoot(ao);
    makeStylusMoveTransformUC(ao);
    const scaleUC = makeScaleTransformUC(ao);
    scaleUC.pixelSensitivity = 0.01;
    const rayScale = makeRayPanScaleTransformUC(ao);
    rayScale.sensitivity = 10;
    // PMs
    makeTransform3DPM(ao);
    // Controllers
    new MouseClickToFocus(ao);
    new MouseOrbit(ao);
    new MousePan(ao);
    new MouseRoll(ao);
    new MouseScale(ao);
    new DoubleTapToFocus(ao);
    new TouchOrbit(ao);
    new TouchPan(ao);
    new TouchPinch(ao);
    new TouchScale(ao);
    new SceneRootMoveSC(ao);
    new PanScaleTransformSC(ao);
    // Setup Tools
    const toolRepo = ToolRepository.get(appObjects);
    if (!toolRepo) {
        appObjects.submitWarning("setupSceneRoot", "Unable to find tool repo");
        return ao;
    }
    toolRepo.makeToolFromData({
        toolType: "ORBIT",
        isDefault: false,
        label: "Orbit",
        shortcutLabel: "o",
        hotkeys: [{ keyCode: "KeyO" }],
    });
    toolRepo.makeToolFromData({
        toolType: "PAN",
        isDefault: true,
        label: "Pan",
        shortcutLabel: "x",
        hotkeys: [{ keyCode: "KeyX" }],
    });
    toolRepo.makeToolFromData({
        toolType: "ZOOM",
        isDefault: false,
        label: "Zoom",
        shortcutLabel: "z",
        hotkeys: [{ keyCode: "KeyZ" }],
    });
    return ao;
}
//# sourceMappingURL=setupSceneRoot.js.map