UNPKG

igniteui-react-core

Version:
461 lines (460 loc) 16.8 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 { d() { let a = new CanvasGestureDOMEventProxy(this.b7, this.b6, this.b0); a.ac = this.ac; a.ar = this.ar; return a; } constructor(a, b, c) { super(); 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)); let d = this.c9; d.holdEnding = delegateCombine(d.holdEnding, runOn(this, this.dq)); let e = this.c9; e.holdStarting = delegateCombine(e.holdStarting, runOn(this, this.dr)); let f = this.c9; f.zoomStarting = delegateCombine(f.zoomStarting, runOn(this, this.dy)); let g = this.c9; g.zoomEnding = delegateCombine(g.zoomEnding, runOn(this, this.dx)); let h = this.c9; h.panStarting = delegateCombine(h.panStarting, runOn(this, this.dw)); let i = this.c9; i.panEnding = delegateCombine(i.panEnding, runOn(this, this.dv)); let j = this.c9; j.manipulationStarting = delegateCombine(j.manipulationStarting, runOn(this, this.du)); let k = this.c9; k.manipulationChanging = delegateCombine(k.manipulationChanging, runOn(this, this.ds)); let l = this.c9; l.manipulationEnding = delegateCombine(l.manipulationEnding, runOn(this, this.dt)); let m = this.c9; m.doubleTapped = delegateCombine(m.doubleTapped, runOn(this, this.dp)); let n = this.c9; n.flingStarting = delegateCombine(n.flingStarting, runOn(this, this.db)); this.ar = (o) => 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 = (q) => true; } db(a, b) { return this.ah({ $type: Point_$type, x: b.a, y: b.b }, b.h, b.i); } dp(a, b) { this.a2({ $type: Point_$type, x: b.a, y: b.b }); } get_ao() { return true; } get_ad() { return this.c9.n == 5; } aw() { super.aw(); this.c9.bd(); } dt(a, b) { if (this.c9.n == 0) { this.a6({ $type: Point_$type, x: b.a, y: b.b }, b.d); this.cv(); } } ds(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 }); } } du(a, b) { } dv(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 }); } } dw(a, b) { this.a5({ $type: Point_$type, x: b.a, y: b.b }); } dx(a, b) { this.bh({ $type: Point_$type, x: b.a, y: b.b }, b.d, b.e, b.c); } dy(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); } dr(a, b) { this.da = true; this.a8({ $type: Point_$type, x: b.a, y: b.b }); } dq(a, b) { if (this.c9.n == 0) { this.az({ $type: Point_$type, x: b.a, y: b.b }, true, false); } } static dd() { 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; } dz(a, b, c) { } av(a, b) { let c = a; if (!this.b6.supportsDOMEvents()) { return; } let d = this.dn + b; let 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) { let source_ = this.b7.getNativeElement(); BaseDOMEventProxy.cx(source_); let 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))); } } d5(e_) { let a = this.bu(e_); let 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_); } } d0(e_) { let a = this.bu(e_); } d1(e_) { let a = this.bu(e_); let b = this.dg.indexOf((e_.originalEvent.pointerId)); if (b >= 0) { this.dg.removeAt(b); this.dh.removeAt(b); this.cb = this.dg.count; } } d2(e_) { let 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)) { let 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_); } } d3(e_) { let a = this.bu(e_); BaseDOMEventProxy.cw(e_); this.c0(e_); this.c2(e_); let 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)) { let 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_); } } d4(e_) { let a = this.bu(e_); if (a) { } else { this.cm(e_); } } d8(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_)); } } dj(e_) { let a = BaseDOMEventProxy.c8(this.b7); let b = this.bo; let c = 0; let d = 0; if (Rect.l_op_Inequality(b, null)) { c = b.left; d = b.top; } this.di.clear(); if (BaseDOMEventProxy.b1) { let e = this.dg.count; for (let j_ = 0; j_ < e; j_++) { let f = this.dg._inner[j_]; let g = this.dh._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.di.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.di.add(n); } } return this.di; } d7(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)); } } de() { let 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); } d6(a) { this.bv = false; this.c0(a); this.c2(a); if (this.bz) { this.bz = false; this.cg(); } let b = this.c9.n; let 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); } let 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); } } d9(a) { if (this.df.containsKey(a)) { let b = this.df.item(a); this.df.removeItem(a); for (let c = 0; c < b.count; c++) { b._inner[c](); } b.clear(); } } bk(a, b) { if (a == null) { return; } let c = a; let d = this.dn + b; this.d9(d); } ax() { if (this.b7 == null) { return; } this.d9(this.dn); this.b7 = null; } static register() { TypeRegistrar.register("CanvasGestureDOMEventProxy", CanvasGestureDOMEventProxy.$); } } CanvasGestureDOMEventProxy.$t = /*@__PURE__*/ markType(CanvasGestureDOMEventProxy, 'CanvasGestureDOMEventProxy', BaseDOMEventProxy.$); CanvasGestureDOMEventProxy.dk = 0; return CanvasGestureDOMEventProxy; })();