import { __assign, __extends } from "tslib";
import { TransformationRestrictor } from "@intelligentgraphics/ig.gfx.threejs";
import { ProcessFurtherOperation } from "./ProcessFurtherOperation";
/** Operation that ensures that a movement is kept inside a given boundary. Only for movement of single components */
var ConstrainToBounds = /** @class */ (function (_super) {
    __extends(ConstrainToBounds, _super);
    function ConstrainToBounds(operation, bounds, componentIds) {
        var _this = _super.call(this, operation) || this;
        _this.componentIds = componentIds;
        _this.restrictor = new TransformationRestrictor(bounds);
        return _this;
    }
    ConstrainToBounds.prototype.processMotionResult = function (resultParam) {
        var transformations = this.restrictor.restrictTransformationToBounds(this.componentIds, resultParam.transformations);
        var result = __assign(__assign({}, resultParam), { transformations: transformations });
        return result;
    };
    ConstrainToBounds.prototype.processEndResult = function (resultParam) {
        var transformations = this.restrictor.restrictTransformationToBounds(this.componentIds, resultParam.transformations);
        var result = __assign(__assign({}, resultParam), { transformations: transformations });
        return result;
    };
    return ConstrainToBounds;
}(ProcessFurtherOperation));
export { ConstrainToBounds };
