/*
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 { Base, INotifyPropertyChanged_$type, PropertyChangedEventArgs, markType } from "igniteui-webcomponents-core";
import { IDragger_$type } from "./IDragger";
import { DraggerView } from "./DraggerView";
import { DragSelectEventArgs } from "./DragSelectEventArgs";
/**
 * @hidden
 */
export let Dragger = /*@__PURE__*/ (() => {
    class Dragger extends Base {
        constructor() {
            super(...arguments);
            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;
        }
        get view() {
            if (this.c == null) {
                this.c = new DraggerView(this);
            }
            return this.c;
        }
        set view(a) {
            this.c = a;
        }
        get dragType() {
            return this.b;
        }
        get isDragActive() {
            return this.e;
        }
        get cellPath() {
            return this.a;
        }
        get viewportWidth() {
            return this.g;
        }
        set viewportWidth(a) {
            let b = this.g;
            this.g = a;
            if (b != this.g) {
                this.j("ViewportWidth", b, this.g);
            }
        }
        get viewportHeight() {
            return this.f;
        }
        set viewportHeight(a) {
            let b = this.f;
            this.f = a;
            if (b != this.f) {
                this.j("ViewportHeight", b, this.f);
            }
        }
        j(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            this.k(a, b, c);
        }
        onDetachedFromUI() {
            this.view.onDetachedFromUI();
        }
        onAttachedToUI() {
            this.view.onAttachedToUI();
        }
        provideContainer(a) {
            this.view.provideContainer(a);
        }
        onMouseMove(a, b) {
            if (this.e) {
                if (this.onDrag != null) {
                    this.onDrag(this, ((() => {
                        let $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;
                    })()));
                }
            }
        }
        onMouseUp(a, b) {
            if (this.e) {
                this.view.releaseMouse();
                this.e = false;
                if (this.onDragEnd != null) {
                    this.onDragEnd(this, new DragSelectEventArgs());
                }
                this.b = 4;
            }
        }
        dragStart(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();
            }
        }
        k(a, b, c) {
            switch (a) {
                case "ViewportWidth":
                case "ViewportHeight":
                    this.view.onViewportSizeChanged(this.g, this.f);
                    break;
            }
        }
    }
    Dragger.$t = /*@__PURE__*/ markType(Dragger, 'Dragger', Base.$, [IDragger_$type, INotifyPropertyChanged_$type]);
    return Dragger;
})();
//# sourceMappingURL=Dragger.js.map
