/*
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, runOn, delegateCombine, Point_$type, markType } from "igniteui-webcomponents-core";
import { IDraggerView_$type } from "./IDraggerView";
import { CanvasGestureDOMEventProxy } from "igniteui-webcomponents-core";
import { Rect } from "igniteui-webcomponents-core";
import { BaseDOMEventProxy } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let DraggerView = /*@__PURE__*/ (() => {
    class DraggerView extends Base {
        constructor(a) {
            super();
            this._model = null;
            this.c = null;
            this.a = null;
            this.model = a;
        }
        get model() {
            return this._model;
        }
        set model(a) {
            this._model = a;
        }
        provideContainer(a) {
            if (a == null) {
                if (this.c != null) {
                    this.c = null;
                }
                if (this.a != null) {
                    this.a.al = null;
                    this.a.ar();
                }
                return;
            }
            this.c = a;
            let b = Math.round(this.c.rootWrapper.width());
            let c = Math.round(this.c.rootWrapper.height());
            this.a = new CanvasGestureDOMEventProxy(this.c.rootWrapper, this.c, true);
            this.a.c3 = true;
            let d = this.a;
            d.onMouseOver = delegateCombine(d.onMouseOver, runOn(this, this.d));
            let e = this.a;
            e.onMouseUp = delegateCombine(e.onMouseUp, runOn(this, this.e));
            this.a.al = runOn(this, this.b);
            this.model.viewportWidth = b;
            this.model.viewportHeight = c;
        }
        onDetachedFromUI() {
            if (this.a != null) {
                this.a.bc(this.c.rootWrapper, "");
            }
        }
        onAttachedToUI() {
            if (this.a != null) {
                this.a.aq(this.c.rootWrapper, "");
            }
        }
        b(a) {
            return this.model.isDragActive;
        }
        d(a, b, c) {
            this.f(a);
        }
        e(a) {
            this.g(a);
        }
        captureMouse() {
        }
        releaseMouse() {
        }
        transformPoint(a, b) {
            let c = BaseDOMEventProxy.cz(this.c.rootWrapper);
            let d = { $type: Point_$type, x: a - c.x, y: b - c.y };
            return d;
        }
        f(a) {
            this.model.onMouseMove(a.x, a.y);
        }
        g(a) {
            this.model.onMouseUp(a.x, a.y);
        }
        onViewportSizeChanged(a, b) {
            this.a.bg = new Rect(0, 0, 0, a, b);
        }
    }
    DraggerView.$t = /*@__PURE__*/ markType(DraggerView, 'DraggerView', Base.$, [IDraggerView_$type]);
    return DraggerView;
})();
//# sourceMappingURL=DraggerView.js.map
