"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var ig_gfx_threejs_1 = require("@intelligentgraphics/ig.gfx.threejs");
var ProcessFurtherOperation_1 = require("./ProcessFurtherOperation");
/** Operation that ensures that a movement is kept inside a given boundary. Only for movement of single components */
var ConstrainToBounds = /** @class */ (function (_super) {
    tslib_1.__extends(ConstrainToBounds, _super);
    function ConstrainToBounds(operation, bounds, componentIds) {
        var _this = _super.call(this, operation) || this;
        _this.componentIds = componentIds;
        _this.restrictor = new ig_gfx_threejs_1.TransformationRestrictor(bounds);
        return _this;
    }
    ConstrainToBounds.prototype.processMotionResult = function (resultParam) {
        var transformations = this.restrictor.restrictTransformationToBounds(this.componentIds, resultParam.transformations);
        var result = tslib_1.__assign(tslib_1.__assign({}, resultParam), { transformations: transformations });
        return result;
    };
    ConstrainToBounds.prototype.processEndResult = function (resultParam) {
        var transformations = this.restrictor.restrictTransformationToBounds(this.componentIds, resultParam.transformations);
        var result = tslib_1.__assign(tslib_1.__assign({}, resultParam), { transformations: transformations });
        return result;
    };
    return ConstrainToBounds;
}(ProcessFurtherOperation_1.ProcessFurtherOperation));
exports.ConstrainToBounds = ConstrainToBounds;
