igniteui-react-core
Version:
Ignite UI React Core.
462 lines (461 loc) • 16.9 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 { __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.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));
var d = _this.c5;
d.holdEnding = delegateCombine(d.holdEnding, runOn(_this, _this.dl));
var e = _this.c5;
e.holdStarting = delegateCombine(e.holdStarting, runOn(_this, _this.dm));
var f = _this.c5;
f.zoomStarting = delegateCombine(f.zoomStarting, runOn(_this, _this.du));
var g = _this.c5;
g.zoomEnding = delegateCombine(g.zoomEnding, runOn(_this, _this.dt));
var h = _this.c5;
h.panStarting = delegateCombine(h.panStarting, runOn(_this, _this.ds));
var i = _this.c5;
i.panEnding = delegateCombine(i.panEnding, runOn(_this, _this.dr));
var j = _this.c5;
j.manipulationStarting = delegateCombine(j.manipulationStarting, runOn(_this, _this.dq));
var k = _this.c5;
k.manipulationChanging = delegateCombine(k.manipulationChanging, runOn(_this, _this.dn));
var l = _this.c5;
l.manipulationEnding = delegateCombine(l.manipulationEnding, runOn(_this, _this.dp));
var m = _this.c5;
m.doubleTapped = delegateCombine(m.doubleTapped, runOn(_this, _this.dk));
var n = _this.c5;
n.flingStarting = delegateCombine(n.flingStarting, runOn(_this, _this.c7));
_this.ap = function (o) { return 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 = function (q) { return true; };
return _this;
}
CanvasGestureDOMEventProxy.prototype.d = function () {
var a = new CanvasGestureDOMEventProxy(this.b4, this.b3, this.bx);
a.ab = this.ab;
a.ap = this.ap;
return a;
};
CanvasGestureDOMEventProxy.prototype.c7 = function (a, b) {
return this.ag({ $type: Point_$type, x: b.a, y: b.b }, b.h, b.i);
};
CanvasGestureDOMEventProxy.prototype.dk = function (a, b) {
this.a0({ $type: Point_$type, x: b.a, y: b.b });
};
CanvasGestureDOMEventProxy.prototype.get_an = function () {
return true;
};
CanvasGestureDOMEventProxy.prototype.get_ac = function () {
return this.c5.n == 5;
};
CanvasGestureDOMEventProxy.prototype.au = function () {
_super.prototype.au.call(this);
this.c5.bd();
};
CanvasGestureDOMEventProxy.prototype.dp = function (a, b) {
if (this.c5.n == 0) {
this.a4({ $type: Point_$type, x: b.a, y: b.b }, b.d);
this.cr();
}
};
CanvasGestureDOMEventProxy.prototype.dn = function (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 });
}
};
CanvasGestureDOMEventProxy.prototype.dq = function (a, b) {
};
CanvasGestureDOMEventProxy.prototype.dr = function (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 });
}
};
CanvasGestureDOMEventProxy.prototype.ds = function (a, b) {
this.a3({ $type: Point_$type, x: b.a, y: b.b });
};
CanvasGestureDOMEventProxy.prototype.dt = function (a, b) {
this.be({ $type: Point_$type, x: b.a, y: b.b }, b.d, b.e, b.c);
};
CanvasGestureDOMEventProxy.prototype.du = function (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);
};
CanvasGestureDOMEventProxy.prototype.dm = function (a, b) {
this.c6 = true;
this.a5({ $type: Point_$type, x: b.a, y: b.b });
};
CanvasGestureDOMEventProxy.prototype.dl = function (a, b) {
if (this.c5.n == 0) {
this.ax({ $type: Point_$type, x: b.a, y: b.b }, true, false);
}
};
CanvasGestureDOMEventProxy.c9 = function () {
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;
};
CanvasGestureDOMEventProxy.prototype.dv = function (a, b, c) {
};
CanvasGestureDOMEventProxy.prototype.at = function (a, b) {
var c = a;
if (!this.b3.supportsDOMEvents()) {
return;
}
var d = this.dj + b;
var 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) {
var source_ = this.b4.getNativeElement();
BaseDOMEventProxy.ct(source_);
var 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)));
}
};
CanvasGestureDOMEventProxy.prototype.d1 = function (e_) {
var a = this.br(e_);
var 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_);
}
};
CanvasGestureDOMEventProxy.prototype.dw = function (e_) {
var a = this.br(e_);
};
CanvasGestureDOMEventProxy.prototype.dx = function (e_) {
var a = this.br(e_);
var b = this.dc.indexOf((e_.originalEvent.pointerId));
if (b >= 0) {
this.dc.removeAt(b);
this.dd.removeAt(b);
this.b8 = this.dc.count;
}
};
CanvasGestureDOMEventProxy.prototype.dy = function (e_) {
var 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)) {
var 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_);
}
};
CanvasGestureDOMEventProxy.prototype.dz = function (e_) {
var a = this.br(e_);
BaseDOMEventProxy.cs(e_);
this.cw(e_);
this.cy(e_);
var 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)) {
var 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_);
}
};
CanvasGestureDOMEventProxy.prototype.d0 = function (e_) {
var a = this.br(e_);
if (a) {
}
else {
this.ci(e_);
}
};
CanvasGestureDOMEventProxy.prototype.d4 = function (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_));
}
};
CanvasGestureDOMEventProxy.prototype.df = function (e_) {
var a = BaseDOMEventProxy.c4(this.b4);
var b = this.bl;
var c = 0;
var d = 0;
if (Rect.l_op_Inequality(b, null)) {
c = b.left;
d = b.top;
}
this.de.clear();
if (BaseDOMEventProxy.by) {
var e = this.dc.count;
for (var j_ = 0; j_ < e; j_++) {
var f = this.dc._inner[j_];
var g = this.dd._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.de.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.de.add(n);
}
}
return this.de;
};
CanvasGestureDOMEventProxy.prototype.d3 = function (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));
}
};
CanvasGestureDOMEventProxy.prototype.da = function () {
var 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);
};
CanvasGestureDOMEventProxy.prototype.d2 = function (a) {
this.bs = false;
this.cw(a);
this.cy(a);
if (this.bw) {
this.bw = false;
this.cd();
}
var b = this.c5.n;
var 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);
}
var 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);
}
};
CanvasGestureDOMEventProxy.prototype.d5 = function (a) {
if (this.db.containsKey(a)) {
var b = this.db.item(a);
this.db.removeItem(a);
for (var c = 0; c < b.count; c++) {
b._inner[c]();
}
b.clear();
}
};
CanvasGestureDOMEventProxy.prototype.bh = function (a, b) {
if (a == null) {
return;
}
var c = a;
var d = this.dj + b;
this.d5(d);
};
CanvasGestureDOMEventProxy.prototype.av = function () {
if (this.b4 == null) {
return;
}
this.d5(this.dj);
this.b4 = null;
};
CanvasGestureDOMEventProxy.register = function () {
TypeRegistrar.register("CanvasGestureDOMEventProxy", CanvasGestureDOMEventProxy.$);
};
CanvasGestureDOMEventProxy.$t = markType(CanvasGestureDOMEventProxy, 'CanvasGestureDOMEventProxy', BaseDOMEventProxy.$);
CanvasGestureDOMEventProxy.dg = 0;
return CanvasGestureDOMEventProxy;
}(BaseDOMEventProxy));
export { CanvasGestureDOMEventProxy };