"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.releaseLabelDropAnswerItemScreen = releaseLabelDropAnswerItemScreen;
const core_1 = require("@vived/core");
const PixelToSceneRayUC_1 = require("../../Babylon/UC/PixelToSceneRayUC");
const FramedScreenEntity_1 = require("../../FramedScreen/Entities/FramedScreenEntity");
const DragLabelDropUC_1 = require("../UseCases/DragLabelDropUC");
function releaseLabelDropAnswerItemScreen(screenX, screenY, appObjects) {
    const uc = DragLabelDropUC_1.DragLabelDropUC.get(appObjects);
    if (!uc) {
        appObjects.submitWarning("releaseLabelDropAnswerItem", "Unable to find DragLabelDropUC");
        return;
    }
    let pickOffsetX = 0;
    let pickOffsetY = 0;
    const framedScreen = appObjects.getSingleton(FramedScreenEntity_1.FramedScreenEntity.type);
    const renderCanvas = framedScreen?.getContainerByID("Render_Canvas");
    if (renderCanvas) {
        pickOffsetX += renderCanvas.position.x;
        pickOffsetY += renderCanvas.position.y;
    }
    const ray = PixelToSceneRayUC_1.PixelToSceneRayUC.get(appObjects)?.pixelToSceneRay(new core_1.Vector2(screenX - pickOffsetX, screenY - pickOffsetY));
    if (ray) {
        uc.release(ray);
    }
}
//# sourceMappingURL=releaseLabelDropAnswerItemScreen.js.map