UNPKG

igniteui-react-core

Version:
463 lines (462 loc) 16.9 kB
/* 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 { __extends } from "tslib"; import { BaseDOMEventProxy } from "./BaseDOMEventProxy"; import { TypeRegistrar, runOn, delegateCombine, Point_$type, String_$type, Delegate_$type, Number_$type, markType } from "./type"; import { TouchGestureRecognizer } from "./TouchGestureRecognizer"; import { Dictionary$2 } from "./Dictionary$2"; import { List$1 } from "./List$1"; import { TouchPointInfo } from "./TouchPointInfo"; import { DOMExecutionContext } from "./DOMExecutionContext"; import { Rect } from "./Rect"; /** * @hidden */ var CanvasGestureDOMEventProxy = /** @class */ /*@__PURE__*/ (function (_super) { __extends(CanvasGestureDOMEventProxy, _super); function CanvasGestureDOMEventProxy(a, b, c) { var _this = _super.call(this) || this; _this.dl = 0; _this.dn = ""; _this.c9 = null; _this.dm = null; _this.df = new Dictionary$2(String_$type, List$1.$.specialize(Delegate_$type), 0); _this.eb = null; _this.da = false; _this.dg = new List$1(Number_$type, 0); _this.dh = new List$1(Point_$type, 0); _this.dc = false; _this.di = new List$1(TouchPointInfo.$, 0); _this.b0 = c; _this.b6 = b; _this.c9 = new TouchGestureRecognizer(new DOMExecutionContext(b)); var d = _this.c9; d.holdEnding = delegateCombine(d.holdEnding, runOn(_this, _this.dq)); var e = _this.c9; e.holdStarting = delegateCombine(e.holdStarting, runOn(_this, _this.dr)); var f = _this.c9; f.zoomStarting = delegateCombine(f.zoomStarting, runOn(_this, _this.dy)); var g = _this.c9; g.zoomEnding = delegateCombine(g.zoomEnding, runOn(_this, _this.dx)); var h = _this.c9; h.panStarting = delegateCombine(h.panStarting, runOn(_this, _this.dw)); var i = _this.c9; i.panEnding = delegateCombine(i.panEnding, runOn(_this, _this.dv)); var j = _this.c9; j.manipulationStarting = delegateCombine(j.manipulationStarting, runOn(_this, _this.du)); var k = _this.c9; k.manipulationChanging = delegateCombine(k.manipulationChanging, runOn(_this, _this.ds)); var l = _this.c9; l.manipulationEnding = delegateCombine(l.manipulationEnding, runOn(_this, _this.dt)); var m = _this.c9; m.doubleTapped = delegateCombine(m.doubleTapped, runOn(_this, _this.dp)); var n = _this.c9; n.flingStarting = delegateCombine(n.flingStarting, runOn(_this, _this.db)); _this.ar = function (o) { return true; }; _this.ac = true; CanvasGestureDOMEventProxy.dk++; _this.dl = CanvasGestureDOMEventProxy.dk; _this.dn = ".DOMProxy" + _this.dl.toString(); _this.bl = 0; _this.b7 = a; BaseDOMEventProxy.bw = false; try { BaseDOMEventProxy.bw = (window.navigator.msPointerEnabled && window.MSGesture !== undefined); } catch (o) { } BaseDOMEventProxy.bx = false; try { BaseDOMEventProxy.bx = (window.PointerEvent !== undefined); } catch (p) { } if (BaseDOMEventProxy.b1) { _this.ac = false; } BaseDOMEventProxy.cf = _this.ce(); BaseDOMEventProxy.cc = _this.cd(); _this.av(_this.b7, ""); _this.aq = function (q) { return true; }; return _this; } CanvasGestureDOMEventProxy.prototype.d = function () { var a = new CanvasGestureDOMEventProxy(this.b7, this.b6, this.b0); a.ac = this.ac; a.ar = this.ar; return a; }; CanvasGestureDOMEventProxy.prototype.db = function (a, b) { return this.ah({ $type: Point_$type, x: b.a, y: b.b }, b.h, b.i); }; CanvasGestureDOMEventProxy.prototype.dp = function (a, b) { this.a2({ $type: Point_$type, x: b.a, y: b.b }); }; CanvasGestureDOMEventProxy.prototype.get_ao = function () { return true; }; CanvasGestureDOMEventProxy.prototype.get_ad = function () { return this.c9.n == 5; }; CanvasGestureDOMEventProxy.prototype.aw = function () { _super.prototype.aw.call(this); this.c9.bd(); }; CanvasGestureDOMEventProxy.prototype.dt = function (a, b) { if (this.c9.n == 0) { this.a6({ $type: Point_$type, x: b.a, y: b.b }, b.d); this.cv(); } }; CanvasGestureDOMEventProxy.prototype.ds = function (a, b) { if (this.c9.n == 2) { this.bf({ $type: Point_$type, x: b.a, y: b.b }, b.d); this.bi({ $type: Point_$type, x: b.a, y: b.b }, b.d, b.e, b.c); } if (this.c9.n == 1 || this.c9.n == 5) { this.a0({ $type: Point_$type, x: b.a, y: b.b }, true); this.a4({ $type: Point_$type, x: b.a, y: b.b }); } }; CanvasGestureDOMEventProxy.prototype.du = function (a, b) { }; CanvasGestureDOMEventProxy.prototype.dv = function (a, b) { this.da = false; if (this.c9.n == 0) { this.az({ $type: Point_$type, x: b.a, y: b.b }, true, false); this.a3({ $type: Point_$type, x: b.a, y: b.b }); } }; CanvasGestureDOMEventProxy.prototype.dw = function (a, b) { this.a5({ $type: Point_$type, x: b.a, y: b.b }); }; CanvasGestureDOMEventProxy.prototype.dx = function (a, b) { this.bh({ $type: Point_$type, x: b.a, y: b.b }, b.d, b.e, b.c); }; CanvasGestureDOMEventProxy.prototype.dy = function (a, b) { this.bg({ $type: Point_$type, x: b.a, y: b.b }, 1); this.bj({ $type: Point_$type, x: b.a, y: b.b }, 1, 1, 1); }; CanvasGestureDOMEventProxy.prototype.dr = function (a, b) { this.da = true; this.a8({ $type: Point_$type, x: b.a, y: b.b }); }; CanvasGestureDOMEventProxy.prototype.dq = function (a, b) { if (this.c9.n == 0) { this.az({ $type: Point_$type, x: b.a, y: b.b }, true, false); } }; CanvasGestureDOMEventProxy.dd = function () { BaseDOMEventProxy.bw = false; try { BaseDOMEventProxy.bw = (window.navigator.msPointerEnabled && window.MSGesture !== undefined); } catch (a) { } BaseDOMEventProxy.bx = false; try { BaseDOMEventProxy.bx = (window.PointerEvent !== undefined); } catch (b) { } return BaseDOMEventProxy.b1; }; CanvasGestureDOMEventProxy.prototype.dz = function (a, b, c) { }; CanvasGestureDOMEventProxy.prototype.av = function (a, b) { var c = a; if (!this.b6.supportsDOMEvents()) { return; } var d = this.dn + b; var e = new List$1(Delegate_$type, 0); this.df.addItem(d, e); this.dz(a, b, e); if (!BaseDOMEventProxy.b1) { e.add(c.listen("mousemove", runOn(this, this.cn))); e.add(c.listen("mouseleave", runOn(this, this.cm))); e.add(c.listen("mousedown", runOn(this, this.cl))); e.add(c.listen("mouseup", runOn(this, this.cp))); e.add(this.b6.globalListen("window", "mouseup", runOn(this, this.c3))); } e.add(c.listen("keydown", runOn(this, this.ci))); e.add(c.listen("keyup", runOn(this, this.ck))); e.add(c.listen("focusin", runOn(this, this.ch))); if (BaseDOMEventProxy.b1) { var source_ = this.b7.getNativeElement(); BaseDOMEventProxy.cx(source_); var f = this.b7.getNativeElement(); if (BaseDOMEventProxy.bx) { e.add(c.listen("pointerdown", runOn(this, this.d2))); e.add(c.listen("pointerup", runOn(this, this.d5))); e.add(c.listen("pointercancel", runOn(this, this.d1))); e.add(c.listen("pointermove", runOn(this, this.d3))); e.add(c.listen("pointerleave", runOn(this, this.d4))); e.add(c.listen("lostpointercapture", runOn(this, this.d0))); } else { e.add(c.listen("MSPointerDown", runOn(this, this.d2))); e.add(c.listen("MSPointerUp", runOn(this, this.d5))); e.add(c.listen("MSPointerCancel", runOn(this, this.d1))); e.add(c.listen("MSPointerMove", runOn(this, this.d3))); e.add(c.listen("MSPointerLeave", runOn(this, this.d4))); e.add(c.listen("MSLostPointerCapture", runOn(this, this.d0))); } } else { e.add(c.listen("touchstart", runOn(this, this.d8))); e.add(c.listen("touchmove", runOn(this, this.d7))); e.add(c.listen("touchend", runOn(this, this.d6))); } if (this.b0) { e.add(c.listen("wheel", runOn(this, this.cq))); } else { e.add(c.listen("DOMMouseScroll", runOn(this, this.co))); e.add(c.listen("mousewheel", runOn(this, this.co))); } }; CanvasGestureDOMEventProxy.prototype.d5 = function (e_) { var a = this.bu(e_); var b = this.dg.indexOf((e_.originalEvent.pointerId)); if (b >= 0) { this.dg.removeAt(b); this.dh.removeAt(b); this.cb = this.dg.count; } if (a) { this.d6(e_); } else { this.cp(e_); } }; CanvasGestureDOMEventProxy.prototype.d0 = function (e_) { var a = this.bu(e_); }; CanvasGestureDOMEventProxy.prototype.d1 = function (e_) { var a = this.bu(e_); var b = this.dg.indexOf((e_.originalEvent.pointerId)); if (b >= 0) { this.dg.removeAt(b); this.dh.removeAt(b); this.cb = this.dg.count; } }; CanvasGestureDOMEventProxy.prototype.d2 = function (e_) { var a = this.bu(e_); BaseDOMEventProxy.cw(e_); this.dg.add((e_.originalEvent.pointerId)); this.dh.add({ $type: Point_$type, x: e_.pageX, y: e_.pageY }); this.cb = this.dg.count; if (a) { this.c2(e_); } else { this.c1(e_); } this.c0(e_); if (!this.dc && this.ae(this.c7, a, false)) { var eventSource_ = this.b7.getNativeElement(); if (BaseDOMEventProxy.bx) { eventSource_.setPointerCapture(e_.originalEvent.pointerId); } else { eventSource_.msSetPointerCapture(e_.originalEvent.pointerId); } } if (a) { this.d8(e_); } else { this.cl(e_); } }; CanvasGestureDOMEventProxy.prototype.d3 = function (e_) { var a = this.bu(e_); BaseDOMEventProxy.cw(e_); this.c0(e_); this.c2(e_); var b = this.dg.indexOf((e_.originalEvent.pointerId)); if (b >= 0) { this.dh._inner[b] = { $type: Point_$type, x: e_.pageX, y: e_.pageY }; } if (this.dc && this.ae(this.c7, a, false)) { var eventSource_ = this.b7.getNativeElement(); if (BaseDOMEventProxy.bx) { eventSource_.setPointerCapture(e_.originalEvent.pointerId); } else { eventSource_.msSetPointerCapture(e_.originalEvent.pointerId); } } if (a) { this.d7(e_); } else { this.cn(e_); } }; CanvasGestureDOMEventProxy.prototype.d4 = function (e_) { var a = this.bu(e_); if (a) { } else { this.cm(e_); } }; CanvasGestureDOMEventProxy.prototype.d8 = function (e_) { this.bv = true; this.c0(e_); this.c2(e_); this.eb = this.c6; if (this.ae(this.c7, true, false)) { if (!this.ac || this.cb > 1) { if (this.bz) { this.bz = false; this.cg(); } this.cy(e_); } else { this.bz = true; this.da = false; } this.bd(this.c7, false, true); this.ba(this.c7); this.a1(this.c6, true); this.c9.a7(this.dj(e_)); } }; CanvasGestureDOMEventProxy.prototype.dj = function (e_) { var a = BaseDOMEventProxy.c8(this.b7); var b = this.bo; var c = 0; var d = 0; if (Rect.l_op_Inequality(b, null)) { c = b.left; d = b.top; } this.di.clear(); if (BaseDOMEventProxy.b1) { var e = this.dg.count; for (var j_ = 0; j_ < e; j_++) { var f = this.dg._inner[j_]; var g = this.dh._inner[j_]; var h = g.x; var i = g.y; var j = new TouchPointInfo(1); j.a = (h - a.left) - b.left; j.b = (i - a.top) - b.top; this.di.add(j); } } else { var k = (e_.originalEvent.targetTouches.length); for (var j_ = 0; j_ < k; j_++) { var l = (e_.originalEvent.targetTouches[j_].pageX); var m = (e_.originalEvent.targetTouches[j_].pageY); var n = new TouchPointInfo(1); n.a = (l - a.left) - c; n.b = (m - a.top) - d; this.di.add(n); } } return this.di; }; CanvasGestureDOMEventProxy.prototype.d7 = function (a) { this.bv = true; this.c0(a); this.c2(a); if (this.bz) { if ((this.ae(this.c7, true, false) && this.de()) || this.da == true || this.c9.n == 2) { this.bz = false; this.cg(); } } if ((this.da || this.c9.n == 2 || this.ae(this.c7, true, false)) && !this.bz) { this.da = true; this.cy(a); this.c9.a7(this.dj(a)); } }; CanvasGestureDOMEventProxy.prototype.de = function () { var a = { $type: Point_$type, x: this.eb.x - this.c6.x, y: this.eb.y - this.c6.y }; if (Math.abs(a.x) > Math.abs(a.y)) { a.y = 0; } if (Math.abs(a.y) > Math.abs(a.x)) { a.x = 0; } return this.ar(a); }; CanvasGestureDOMEventProxy.prototype.d6 = function (a) { this.bv = false; this.c0(a); this.c2(a); if (this.bz) { this.bz = false; this.cg(); } var b = this.c9.n; var c = this.ae(this.c7, true, false) || b != 0; if (this.c9.n != 2 && this.c9.n != 5) { this.bd(this.c7, false, true); this.be(this.c7); } var d = this.c9.n == 2; if (d) { c = true; this.az({ $type: Point_$type, x: this.c9.at, y: this.c9.au }, true, true); } this.c9.a7(this.dj(a)); if (this.c9.n == 0) { this.cv(); } if (!d && this.c9.n == 0) { this.az({ $type: Point_$type, x: this.c9.at, y: this.c9.au }, true, false); } if (this.c9.n != 0) { c = true; } if (c) { this.cy(a); } }; CanvasGestureDOMEventProxy.prototype.d9 = function (a) { if (this.df.containsKey(a)) { var b = this.df.item(a); this.df.removeItem(a); for (var c = 0; c < b.count; c++) { b._inner[c](); } b.clear(); } }; CanvasGestureDOMEventProxy.prototype.bk = function (a, b) { if (a == null) { return; } var c = a; var d = this.dn + b; this.d9(d); }; CanvasGestureDOMEventProxy.prototype.ax = function () { if (this.b7 == null) { return; } this.d9(this.dn); this.b7 = null; }; CanvasGestureDOMEventProxy.register = function () { TypeRegistrar.register("CanvasGestureDOMEventProxy", CanvasGestureDOMEventProxy.$); }; CanvasGestureDOMEventProxy.$t = markType(CanvasGestureDOMEventProxy, 'CanvasGestureDOMEventProxy', BaseDOMEventProxy.$); CanvasGestureDOMEventProxy.dk = 0; return CanvasGestureDOMEventProxy; }(BaseDOMEventProxy)); export { CanvasGestureDOMEventProxy };