/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { Base, INotifyPropertyChanged_$type, PropertyChangedEventArgs, markType } from "igniteui-webcomponents-core";
import { IDragger_$type } from "./IDragger";
import { DraggerView } from "./DraggerView";
import { DragSelectEventArgs } from "./DragSelectEventArgs";
/**
 * @hidden
 */
var Dragger = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(Dragger, _super);
    function Dragger() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.l = null;
        _this.d = false;
        _this.c = null;
        _this.b = 4;
        _this.e = false;
        _this.a = null;
        _this.g = 0;
        _this.f = 0;
        _this.onDrag = null;
        _this.onDragEnd = null;
        _this.propertyChanged = null;
        return _this;
    }
    Object.defineProperty(Dragger.prototype, "view", {
        get: function () {
            if (this.c == null) {
                this.c = new DraggerView(this);
            }
            return this.c;
        },
        set: function (a) {
            this.c = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Dragger.prototype, "dragType", {
        get: function () {
            return this.b;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Dragger.prototype, "isDragActive", {
        get: function () {
            return this.e;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Dragger.prototype, "cellPath", {
        get: function () {
            return this.a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Dragger.prototype, "viewportWidth", {
        get: function () {
            return this.g;
        },
        set: function (a) {
            var b = this.g;
            this.g = a;
            if (b != this.g) {
                this.j("ViewportWidth", b, this.g);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Dragger.prototype, "viewportHeight", {
        get: function () {
            return this.f;
        },
        set: function (a) {
            var b = this.f;
            this.f = a;
            if (b != this.f) {
                this.j("ViewportHeight", b, this.f);
            }
        },
        enumerable: true,
        configurable: true
    });
    Dragger.prototype.j = function (a, b, c) {
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
        this.k(a, b, c);
    };
    Dragger.prototype.onDetachedFromUI = function () {
        this.view.onDetachedFromUI();
    };
    Dragger.prototype.onAttachedToUI = function () {
        this.view.onAttachedToUI();
    };
    Dragger.prototype.provideContainer = function (a) {
        this.view.provideContainer(a);
    };
    Dragger.prototype.onMouseMove = function (a, b) {
        var _this = this;
        if (this.e) {
            if (this.onDrag != null) {
                this.onDrag(this, ((function () {
                    var $ret = new DragSelectEventArgs();
                    $ret.startX = _this.l.x;
                    $ret.startY = _this.l.y;
                    $ret.currentX = a;
                    $ret.currentY = b;
                    $ret.controlPressed = _this.d;
                    return $ret;
                })()));
            }
        }
    };
    Dragger.prototype.onMouseUp = function (a, b) {
        if (this.e) {
            this.view.releaseMouse();
            this.e = false;
            if (this.onDragEnd != null) {
                this.onDragEnd(this, new DragSelectEventArgs());
            }
            this.b = 4;
        }
    };
    Dragger.prototype.dragStart = function (a, b, c, d, e, f, g) {
        if (!this.e) {
            this.l = this.view.transformPoint(a + c, b + d);
            this.e = true;
            this.d = g;
            this.b = e;
            this.a = f;
            this.view.captureMouse();
        }
    };
    Dragger.prototype.k = function (a, b, c) {
        switch (a) {
            case "ViewportWidth":
            case "ViewportHeight":
                this.view.onViewportSizeChanged(this.g, this.f);
                break;
        }
    };
    Dragger.$t = markType(Dragger, 'Dragger', Base.$, [IDragger_$type, INotifyPropertyChanged_$type]);
    return Dragger;
}(Base));
export { Dragger };
//# sourceMappingURL=Dragger.js.map
