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