UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

462 lines (461 loc) 17.3 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.di = 0; _this.dk = ""; _this.c6 = null; _this.dj = null; _this.dc = new Dictionary$2(String_$type, List$1.$.specialize(Delegate_$type), 0); _this.d8 = null; _this.c7 = false; _this.dd = new List$1(Number_$type, 0); _this.de = new List$1(Point_$type, 0); _this.c9 = false; _this.df = new List$1(TouchPointInfo.$, 0); _this.by = c; _this.b4 = b; _this.c6 = new TouchGestureRecognizer(new DOMExecutionContext(b)); var d = _this.c6; d.holdEnding = delegateCombine(d.holdEnding, runOn(_this, _this.dm)); var e = _this.c6; e.holdStarting = delegateCombine(e.holdStarting, runOn(_this, _this.dn)); var f = _this.c6; f.zoomStarting = delegateCombine(f.zoomStarting, runOn(_this, _this.dv)); var g = _this.c6; g.zoomEnding = delegateCombine(g.zoomEnding, runOn(_this, _this.du)); var h = _this.c6; h.panStarting = delegateCombine(h.panStarting, runOn(_this, _this.dt)); var i = _this.c6; i.panEnding = delegateCombine(i.panEnding, runOn(_this, _this.ds)); var j = _this.c6; j.manipulationStarting = delegateCombine(j.manipulationStarting, runOn(_this, _this.dr)); var k = _this.c6; k.manipulationChanging = delegateCombine(k.manipulationChanging, runOn(_this, _this.dp)); var l = _this.c6; l.manipulationEnding = delegateCombine(l.manipulationEnding, runOn(_this, _this.dq)); var m = _this.c6; m.doubleTapped = delegateCombine(m.doubleTapped, runOn(_this, _this.dl)); var n = _this.c6; n.flingStarting = delegateCombine(n.flingStarting, runOn(_this, _this.c8)); _this.aq = function (o) { return true; }; _this.ab = true; CanvasGestureDOMEventProxy.dh++; _this.di = CanvasGestureDOMEventProxy.dh; _this.dk = ".DOMProxy" + _this.di.toString(); _this.bj = 0; _this.b5 = a; BaseDOMEventProxy.bu = false; try { BaseDOMEventProxy.bu = (window.navigator.msPointerEnabled && window.MSGesture !== undefined); } catch (o) { } BaseDOMEventProxy.bv = false; try { BaseDOMEventProxy.bv = (window.PointerEvent !== undefined); } catch (p) { } if (BaseDOMEventProxy.bz) { _this.ab = false; } BaseDOMEventProxy.cd = _this.cc(); BaseDOMEventProxy.ca = _this.cb(); _this.au(_this.b5, ""); _this.ap = function (q) { return true; }; return _this; } CanvasGestureDOMEventProxy.prototype.d = function () { var a = new CanvasGestureDOMEventProxy(this.b5, this.b4, this.by); a.ab = this.ab; a.aq = this.aq; return a; }; CanvasGestureDOMEventProxy.prototype.c8 = function (a, b) { return this.ag({ $type: Point_$type, x: b.a, y: b.b }, b.h, b.i); }; CanvasGestureDOMEventProxy.prototype.dl = function (a, b) { this.a1({ $type: Point_$type, x: b.a, y: b.b }); }; CanvasGestureDOMEventProxy.prototype.get_an = function () { return true; }; CanvasGestureDOMEventProxy.prototype.get_ac = function () { return this.c6.n == 5; }; CanvasGestureDOMEventProxy.prototype.av = function () { _super.prototype.av.call(this); this.c6.bd(); }; CanvasGestureDOMEventProxy.prototype.dq = function (a, b) { if (this.c6.n == 0) { this.a5({ $type: Point_$type, x: b.a, y: b.b }, b.d); this.cs(); } }; CanvasGestureDOMEventProxy.prototype.dp = function (a, b) { if (this.c6.n == 2) { this.bd({ $type: Point_$type, x: b.a, y: b.b }, b.d); this.bg({ $type: Point_$type, x: b.a, y: b.b }, b.d, b.e, b.c); } if (this.c6.n == 1 || this.c6.n == 5) { this.az({ $type: Point_$type, x: b.a, y: b.b }, true); this.a3({ $type: Point_$type, x: b.a, y: b.b }); } }; CanvasGestureDOMEventProxy.prototype.dr = function (a, b) { }; CanvasGestureDOMEventProxy.prototype.ds = function (a, b) { this.c7 = false; if (this.c6.n == 0) { this.ay({ $type: Point_$type, x: b.a, y: b.b }, true, false); this.a2({ $type: Point_$type, x: b.a, y: b.b }); } }; CanvasGestureDOMEventProxy.prototype.dt = function (a, b) { this.a4({ $type: Point_$type, x: b.a, y: b.b }); }; CanvasGestureDOMEventProxy.prototype.du = function (a, b) { this.bf({ $type: Point_$type, x: b.a, y: b.b }, b.d, b.e, b.c); }; CanvasGestureDOMEventProxy.prototype.dv = function (a, b) { this.be({ $type: Point_$type, x: b.a, y: b.b }, 1); this.bh({ $type: Point_$type, x: b.a, y: b.b }, 1, 1, 1); }; CanvasGestureDOMEventProxy.prototype.dn = function (a, b) { this.c7 = true; this.a6({ $type: Point_$type, x: b.a, y: b.b }); }; CanvasGestureDOMEventProxy.prototype.dm = function (a, b) { if (this.c6.n == 0) { this.ay({ $type: Point_$type, x: b.a, y: b.b }, true, false); } }; CanvasGestureDOMEventProxy.da = function () { BaseDOMEventProxy.bu = false; try { BaseDOMEventProxy.bu = (window.navigator.msPointerEnabled && window.MSGesture !== undefined); } catch (a) { } BaseDOMEventProxy.bv = false; try { BaseDOMEventProxy.bv = (window.PointerEvent !== undefined); } catch (b) { } return BaseDOMEventProxy.bz; }; CanvasGestureDOMEventProxy.prototype.dw = function (a, b, c) { }; CanvasGestureDOMEventProxy.prototype.au = function (a, b) { var c = a; if (!this.b4.supportsDOMEvents()) { return; } var d = this.dk + b; var e = new List$1(Delegate_$type, 0); this.dc.addItem(d, e); this.dw(a, b, e); if (!BaseDOMEventProxy.bz) { e.add(c.listen("mousemove", runOn(this, this.ck))); e.add(c.listen("mouseleave", runOn(this, this.cj))); e.add(c.listen("mousedown", runOn(this, this.ci))); e.add(c.listen("mouseup", runOn(this, this.cm))); e.add(this.b4.globalListen("window", "mouseup", runOn(this, this.c0))); } e.add(c.listen("keydown", runOn(this, this.cf))); e.add(c.listen("keyup", runOn(this, this.ch))); if (BaseDOMEventProxy.bz) { var source_ = this.b5.getNativeElement(); BaseDOMEventProxy.cu(source_); var f = this.b5.getNativeElement(); if (BaseDOMEventProxy.bv) { e.add(c.listen("pointerdown", runOn(this, this.dz))); e.add(c.listen("pointerup", runOn(this, this.d2))); e.add(c.listen("pointercancel", runOn(this, this.dy))); e.add(c.listen("pointermove", runOn(this, this.d0))); e.add(c.listen("pointerleave", runOn(this, this.d1))); e.add(c.listen("lostpointercapture", runOn(this, this.dx))); } else { e.add(c.listen("MSPointerDown", runOn(this, this.dz))); e.add(c.listen("MSPointerUp", runOn(this, this.d2))); e.add(c.listen("MSPointerCancel", runOn(this, this.dy))); e.add(c.listen("MSPointerMove", runOn(this, this.d0))); e.add(c.listen("MSPointerLeave", runOn(this, this.d1))); e.add(c.listen("MSLostPointerCapture", runOn(this, this.dx))); } } else { e.add(c.listen("touchstart", runOn(this, this.d5))); e.add(c.listen("touchmove", runOn(this, this.d4))); e.add(c.listen("touchend", runOn(this, this.d3))); } if (this.by) { e.add(c.listen("wheel", runOn(this, this.cn))); } else { e.add(c.listen("DOMMouseScroll", runOn(this, this.cl))); e.add(c.listen("mousewheel", runOn(this, this.cl))); } }; CanvasGestureDOMEventProxy.prototype.d2 = function (e_) { var a = this.bs(e_); var b = this.dd.indexOf((e_.originalEvent.pointerId)); if (b >= 0) { this.dd.removeAt(b); this.de.removeAt(b); this.b9 = this.dd.count; } if (a) { this.d3(e_); } else { this.cm(e_); } }; CanvasGestureDOMEventProxy.prototype.dx = function (e_) { var a = this.bs(e_); }; CanvasGestureDOMEventProxy.prototype.dy = function (e_) { var a = this.bs(e_); var b = this.dd.indexOf((e_.originalEvent.pointerId)); if (b >= 0) { this.dd.removeAt(b); this.de.removeAt(b); this.b9 = this.dd.count; } }; CanvasGestureDOMEventProxy.prototype.dz = function (e_) { var a = this.bs(e_); BaseDOMEventProxy.ct(e_); this.dd.add((e_.originalEvent.pointerId)); this.de.add({ $type: Point_$type, x: e_.pageX, y: e_.pageY }); this.b9 = this.dd.count; if (a) { this.cz(e_); } else { this.cy(e_); } this.cx(e_); if (!this.c9 && this.ad(this.c4, a, false)) { var eventSource_ = this.b5.getNativeElement(); if (BaseDOMEventProxy.bv) { eventSource_.setPointerCapture(e_.originalEvent.pointerId); } else { eventSource_.msSetPointerCapture(e_.originalEvent.pointerId); } } if (a) { this.d5(e_); } else { this.ci(e_); } }; CanvasGestureDOMEventProxy.prototype.d0 = function (e_) { var a = this.bs(e_); BaseDOMEventProxy.ct(e_); this.cx(e_); this.cz(e_); var b = this.dd.indexOf((e_.originalEvent.pointerId)); if (b >= 0) { this.de._inner[b] = { $type: Point_$type, x: e_.pageX, y: e_.pageY }; } if (this.c9 && this.ad(this.c4, a, false)) { var eventSource_ = this.b5.getNativeElement(); if (BaseDOMEventProxy.bv) { eventSource_.setPointerCapture(e_.originalEvent.pointerId); } else { eventSource_.msSetPointerCapture(e_.originalEvent.pointerId); } } if (a) { this.d4(e_); } else { this.ck(e_); } }; CanvasGestureDOMEventProxy.prototype.d1 = function (e_) { var a = this.bs(e_); if (a) { } else { this.cj(e_); } }; CanvasGestureDOMEventProxy.prototype.d5 = function (e_) { this.bt = true; this.cx(e_); this.cz(e_); this.d8 = this.c3; if (this.ad(this.c4, true, false)) { if (!this.ab || this.b9 > 1) { if (this.bx) { this.bx = false; this.ce(); } this.cv(e_); } else { this.bx = true; this.c7 = false; } this.bb(this.c4, false, true); this.a8(this.c4); this.a0(this.c3, true); this.c6.a7(this.dg(e_)); } }; CanvasGestureDOMEventProxy.prototype.dg = function (e_) { var a = BaseDOMEventProxy.c5(this.b5); var b = this.bm; var c = 0; var d = 0; if (Rect.l_op_Inequality(b, null)) { c = b.left; d = b.top; } this.df.clear(); if (BaseDOMEventProxy.bz) { var e = this.dd.count; for (var j_ = 0; j_ < e; j_++) { var f = this.dd._inner[j_]; var g = this.de._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.df.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.df.add(n); } } return this.df; }; CanvasGestureDOMEventProxy.prototype.d4 = function (a) { this.bt = true; this.cx(a); this.cz(a); if (this.bx) { if ((this.ad(this.c4, true, false) && this.db()) || this.c7 == true || this.c6.n == 2) { this.bx = false; this.ce(); } } if ((this.c7 || this.c6.n == 2 || this.ad(this.c4, true, false)) && !this.bx) { this.c7 = true; this.cv(a); this.c6.a7(this.dg(a)); } }; CanvasGestureDOMEventProxy.prototype.db = function () { var a = { $type: Point_$type, x: this.d8.x - this.c3.x, y: this.d8.y - this.c3.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.aq(a); }; CanvasGestureDOMEventProxy.prototype.d3 = function (a) { this.bt = false; this.cx(a); this.cz(a); if (this.bx) { this.bx = false; this.ce(); } var b = this.c6.n; var c = this.ad(this.c4, true, false) || b != 0; if (this.c6.n != 2 && this.c6.n != 5) { this.bb(this.c4, false, true); this.bc(this.c4); } var d = this.c6.n == 2; if (d) { c = true; this.ay({ $type: Point_$type, x: this.c6.at, y: this.c6.au }, true, true); } this.c6.a7(this.dg(a)); if (this.c6.n == 0) { this.cs(); } if (!d && this.c6.n == 0) { this.ay({ $type: Point_$type, x: this.c6.at, y: this.c6.au }, true, false); } if (this.c6.n != 0) { c = true; } if (c) { this.cv(a); } }; CanvasGestureDOMEventProxy.prototype.d6 = function (a) { if (this.dc.containsKey(a)) { var b = this.dc.item(a); this.dc.removeItem(a); for (var c = 0; c < b.count; c++) { b._inner[c](); } b.clear(); } }; CanvasGestureDOMEventProxy.prototype.bi = function (a, b) { if (a == null) { return; } var c = a; var d = this.dk + b; this.d6(d); }; CanvasGestureDOMEventProxy.prototype.aw = function () { if (this.b5 == null) { return; } this.d6(this.dk); this.b5 = null; }; CanvasGestureDOMEventProxy.register = function () { TypeRegistrar.register("CanvasGestureDOMEventProxy", CanvasGestureDOMEventProxy.$); }; CanvasGestureDOMEventProxy.$t = markType(CanvasGestureDOMEventProxy, 'CanvasGestureDOMEventProxy', BaseDOMEventProxy.$); CanvasGestureDOMEventProxy.dh = 0; return CanvasGestureDOMEventProxy; }(BaseDOMEventProxy)); export { CanvasGestureDOMEventProxy };