UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

460 lines (459 loc) 17.2 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 { 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 */ export let CanvasGestureDOMEventProxy = /*@__PURE__*/ (() => { class CanvasGestureDOMEventProxy extends BaseDOMEventProxy { constructor(a, b, c) { super(); 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)); let d = this.c6; d.holdEnding = delegateCombine(d.holdEnding, runOn(this, this.dm)); let e = this.c6; e.holdStarting = delegateCombine(e.holdStarting, runOn(this, this.dn)); let f = this.c6; f.zoomStarting = delegateCombine(f.zoomStarting, runOn(this, this.dv)); let g = this.c6; g.zoomEnding = delegateCombine(g.zoomEnding, runOn(this, this.du)); let h = this.c6; h.panStarting = delegateCombine(h.panStarting, runOn(this, this.dt)); let i = this.c6; i.panEnding = delegateCombine(i.panEnding, runOn(this, this.ds)); let j = this.c6; j.manipulationStarting = delegateCombine(j.manipulationStarting, runOn(this, this.dr)); let k = this.c6; k.manipulationChanging = delegateCombine(k.manipulationChanging, runOn(this, this.dp)); let l = this.c6; l.manipulationEnding = delegateCombine(l.manipulationEnding, runOn(this, this.dq)); let m = this.c6; m.doubleTapped = delegateCombine(m.doubleTapped, runOn(this, this.dl)); let n = this.c6; n.flingStarting = delegateCombine(n.flingStarting, runOn(this, this.c8)); this.aq = (o) => 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 = (q) => true; } d() { let a = new CanvasGestureDOMEventProxy(this.b5, this.b4, this.by); a.ab = this.ab; a.aq = this.aq; return a; } c8(a, b) { return this.ag({ $type: Point_$type, x: b.a, y: b.b }, b.h, b.i); } dl(a, b) { this.a1({ $type: Point_$type, x: b.a, y: b.b }); } get_an() { return true; } get_ac() { return this.c6.n == 5; } av() { super.av(); this.c6.bd(); } dq(a, b) { if (this.c6.n == 0) { this.a5({ $type: Point_$type, x: b.a, y: b.b }, b.d); this.cs(); } } dp(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 }); } } dr(a, b) { } ds(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 }); } } dt(a, b) { this.a4({ $type: Point_$type, x: b.a, y: b.b }); } du(a, b) { this.bf({ $type: Point_$type, x: b.a, y: b.b }, b.d, b.e, b.c); } dv(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); } dn(a, b) { this.c7 = true; this.a6({ $type: Point_$type, x: b.a, y: b.b }); } dm(a, b) { if (this.c6.n == 0) { this.ay({ $type: Point_$type, x: b.a, y: b.b }, true, false); } } static da() { 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; } dw(a, b, c) { } au(a, b) { let c = a; if (!this.b4.supportsDOMEvents()) { return; } let d = this.dk + b; let 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) { let source_ = this.b5.getNativeElement(); BaseDOMEventProxy.cu(source_); let 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))); } } d2(e_) { let a = this.bs(e_); let 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_); } } dx(e_) { let a = this.bs(e_); } dy(e_) { let a = this.bs(e_); let b = this.dd.indexOf((e_.originalEvent.pointerId)); if (b >= 0) { this.dd.removeAt(b); this.de.removeAt(b); this.b9 = this.dd.count; } } dz(e_) { let 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)) { let 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_); } } d0(e_) { let a = this.bs(e_); BaseDOMEventProxy.ct(e_); this.cx(e_); this.cz(e_); let 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)) { let 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_); } } d1(e_) { let a = this.bs(e_); if (a) { } else { this.cj(e_); } } d5(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_)); } } dg(e_) { let a = BaseDOMEventProxy.c5(this.b5); let b = this.bm; let c = 0; let d = 0; if (Rect.l_op_Inequality(b, null)) { c = b.left; d = b.top; } this.df.clear(); if (BaseDOMEventProxy.bz) { let e = this.dd.count; for (let j_ = 0; j_ < e; j_++) { let f = this.dd._inner[j_]; let g = this.de._inner[j_]; let h = g.x; let i = g.y; let j = new TouchPointInfo(1); j.a = (h - a.left) - b.left; j.b = (i - a.top) - b.top; this.df.add(j); } } else { let k = (e_.originalEvent.targetTouches.length); for (let j_ = 0; j_ < k; j_++) { let l = (e_.originalEvent.targetTouches[j_].pageX); let m = (e_.originalEvent.targetTouches[j_].pageY); let n = new TouchPointInfo(1); n.a = (l - a.left) - c; n.b = (m - a.top) - d; this.df.add(n); } } return this.df; } d4(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)); } } db() { let 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); } d3(a) { this.bt = false; this.cx(a); this.cz(a); if (this.bx) { this.bx = false; this.ce(); } let b = this.c6.n; let 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); } let 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); } } d6(a) { if (this.dc.containsKey(a)) { let b = this.dc.item(a); this.dc.removeItem(a); for (let c = 0; c < b.count; c++) { b._inner[c](); } b.clear(); } } bi(a, b) { if (a == null) { return; } let c = a; let d = this.dk + b; this.d6(d); } aw() { if (this.b5 == null) { return; } this.d6(this.dk); this.b5 = null; } static register() { TypeRegistrar.register("CanvasGestureDOMEventProxy", CanvasGestureDOMEventProxy.$); } } CanvasGestureDOMEventProxy.$t = markType(CanvasGestureDOMEventProxy, 'CanvasGestureDOMEventProxy', BaseDOMEventProxy.$); CanvasGestureDOMEventProxy.dh = 0; return CanvasGestureDOMEventProxy; })();