UNPKG

igniteui-angular-charts

Version:

Ignite UI Angular charting components for building rich data visualizations for modern web apps.

670 lines (669 loc) 22.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 { Base, runOn, delegateCombine, Point_$type, markType, PointUtil } from "igniteui-angular-core"; import { ISeriesViewerScrollbarManager_$type } from "./ISeriesViewerScrollbarManager"; import { Rect } from "igniteui-angular-core"; import { Rectangle } from "igniteui-angular-core"; import { DeviceUtils } from "igniteui-angular-core"; import { BrushUtil } from "igniteui-angular-core"; import { truncate, isNaN_ } from "igniteui-angular-core"; import { dateNow } from "igniteui-angular-core"; import { timeSpanFromMilliseconds, timeSpanTotalMilliseconds } from "igniteui-angular-core"; /** * @hidden */ export let SeriesViewerScrollbarManager = /*@__PURE__*/ (() => { class SeriesViewerScrollbarManager extends Base { constructor() { super(); this.i = false; this.l = true; this._executionContext = null; this._animator = null; this._owner = null; this.b = 0; this.c = 0; this.a = 0; this.d = 0; this.y = SeriesViewerScrollbarManager.aw; this.at = SeriesViewerScrollbarManager.a8; this.ab = SeriesViewerScrollbarManager.ax; this.ag = SeriesViewerScrollbarManager.a1; this.af = SeriesViewerScrollbarManager.a0; this.h = true; this.ao = SeriesViewerScrollbarManager.a4; this.x = SeriesViewerScrollbarManager.av; this.ak = SeriesViewerScrollbarManager.a2; this.as = SeriesViewerScrollbarManager.a7; this.ar = SeriesViewerScrollbarManager.a6; this.n = true; this.bl = SeriesViewerScrollbarManager.bp; this.bn = SeriesViewerScrollbarManager.br; this.bm = SeriesViewerScrollbarManager.bq; this.bo = SeriesViewerScrollbarManager.bs; this.ap = SeriesViewerScrollbarManager.a5; this.ad = SeriesViewerScrollbarManager.az; this.an = SeriesViewerScrollbarManager.a3; this.aa = SeriesViewerScrollbarManager.ay; this.bw = Rect.empty; this.bz = Rect.empty; this.ai = 0; this.au = 0; this.aq = 0; this.aj = 0; this.al = 0; this.z = 0; this.ac = 0; this.ah = 0; this.am = 0; this.ae = 0; this.g = false; this.b2 = new Rectangle(); this.m = false; this.b3 = new Rectangle(); this.bx = null; this.by = null; this.t = new Date(); this.f = false; this.a9 = 1000; this.e = false; this.w = 0; this.u = 0; this.bv = PointUtil.create(); this.j = false; this.k = false; this.bt = { $type: Point_$type, x: NaN, y: NaN }; this.v = 10; this.bu = null; this.w = 1; this.b = 0; this.c = 0; this.a = 1; this.d = 2; } get o() { return this.i; } get executionContext() { return this._executionContext; } set executionContext(a) { this._executionContext = a; } get animator() { return this._animator; } set animator(a) { this._animator = a; } get owner() { return this._owner; } set owner(a) { this._owner = a; } onHorizontalScrollbarModeChanged(a) { let b = this.b; this.b = a; switch (a) { case 0: if (b != 0) { this.be(); } this.i = false; break; case 1: this.i = true; break; case 2: this.i = true; break; case 3: this.i = true; break; } } onVerticalScrollbarModeChanged(a) { let b = this.c; this.c = a; switch (a) { case 0: if (b != 0) { this.bf(); } this.i = false; break; case 1: this.i = true; break; case 2: this.i = true; break; case 3: this.i = true; break; } } bf() { this.b3._visibility = 1; } be() { this.b2._visibility = 1; } updateScrollbars(a, b, c, d, e) { if (c.isEmpty || e.isEmpty) { this.be(); this.bf(); return; } if (b.equals1(c) && d.equals1(e)) { return; } if (!b.equals1(c)) { this.bd(); } this.bj(a, c, e); { this.bc(); } } bd() { if (!this.l) { this.w = 0; } if (this.animator.f()) { this.animator.w(); } this.t = dateNow(); } updateBarDimensions(a, b, c, d, e, f, g, h, i, j, k, l, m) { let n = false; let o = isNaN_(b) ? SeriesViewerScrollbarManager.aw : b; let p = isNaN_(c) ? SeriesViewerScrollbarManager.av : c; let q = isNaN_(d) ? SeriesViewerScrollbarManager.ax : d; let r = isNaN_(f) ? SeriesViewerScrollbarManager.a1 : f; let s = isNaN_(g) ? SeriesViewerScrollbarManager.a0 : g; let t = e; let u = isNaN_(h) ? SeriesViewerScrollbarManager.a8 : h; let v = isNaN_(i) ? SeriesViewerScrollbarManager.a2 : i; let w = isNaN_(j) ? SeriesViewerScrollbarManager.a4 : j; let x = isNaN_(l) ? SeriesViewerScrollbarManager.a7 : l; let y = isNaN_(m) ? SeriesViewerScrollbarManager.a6 : m; let z = k; if (o != this.y) { this.y = o; n = true; } if (p != this.x) { this.x = p; n = true; } if (q != this.ab) { this.ab = q; n = true; } if (r != this.ag) { this.ag = r; n = true; } if (s != this.af) { this.af = s; n = true; } if (t != this.h) { this.h = t; n = true; } if (u != this.at) { this.at = u; n = true; } if (v != this.ak) { this.ak = v; n = true; } if (w != this.ao) { this.ao = w; n = true; } if (x != this.as) { this.as = x; n = true; } if (y != this.ar) { this.ar = y; n = true; } if (z != this.n) { this.n = z; n = true; } if (n) { this.bj(a, this.bw, this.bz); } } updateBarAppearance(a, b, c, d, e, f, g, h, i) { let j = false; let k = b == null ? SeriesViewerScrollbarManager.bp : b; let l = d == null ? SeriesViewerScrollbarManager.bq : d; let m = c == null ? SeriesViewerScrollbarManager.br : c; let n = e == null ? SeriesViewerScrollbarManager.bs : e; let o = isNaN_(f) ? SeriesViewerScrollbarManager.az : f; let p = isNaN_(g) ? SeriesViewerScrollbarManager.a5 : g; if (k != this.bl) { this.bl = k; j = true; } if (m != this.bn) { this.bn = m; j = true; } if (l != this.bm) { this.bm = l; j = true; } if (n != this.bo) { this.bo = n; j = true; } if (p != this.ap) { this.ap = p; j = true; } if (p != this.ap) { this.ap = p; j = true; } if (j) { this.bj(a, this.bw, this.bz); } } updateVerticalScrollbarPosition(a) { switch (a) { case 0: case 2: this.d = 2; break; case 1: this.d = 1; break; } this.bj(this.owner, this.bw, this.bz); } updateHorizontalScrollbarPosition(a) { switch (a) { case 0: case 1: this.a = 1; break; case 2: this.a = 2; break; } this.bj(this.owner, this.bw, this.bz); } bj(a, b, c) { if (!b.isEmpty && (b.width < 1 || b.height < 1)) { this.l = false; } this.bw = b; this.bz = c; if (b.isEmpty || c.isEmpty) { this.be(); this.bf(); return; } let d = c; let e = c; d = this.b0(a, d); if (d.isEmpty) { this.be(); this.bf(); return; } this.bx = d; e = this.b1(a, e); if (e.isEmpty) { this.be(); this.bf(); return; } this.by = e; let f = b.top * e.height + e.top; let g = b.bottom * e.height + e.top; let h = b.left * d.width + d.left; let i = b.right * d.width + d.left; let j = g - f; let k = i - h; let l = Math.max(j, this.ak * 2); let m = Math.max(k, this.x * 2); let n = 0; let o = 0; if (m > k) { n = (m - k) / 2; h -= n; i += n; k = m; } this.ai = n; if (l > j) { o = (l - j) / 2; f -= o; g += o; j = l; } this.au = o; this.aq = f; this.aj = g; this.al = j; this.z = h; this.ac = i; this.ah = k; if (this.d == 2) { this.am = e.right - (this.at + this.ao); } else { this.am = e.left + (this.ao); } if (this.a == 1) { this.ae = d.bottom - (this.y + this.ab); } else { this.ae = d.top + (this.ab); } this.bk(a); } b0(a, b) { let c = 0; let d = 0; if (this.h) { switch (this.a) { case 1: case 2: if (this.c != 0) { if (this.d == 2) { d = this.at + this.ao + 1; } if (this.d == 1) { c = this.at + this.ao + 1; } } break; } } let e = b.width - (c + d); if (e <= 0) { return Rect.empty; } return new Rect(0, b.left + c, b.top, e, b.height); } b1(a, b) { let c = 0; let d = 0; if (this.n) { switch (this.d) { case 1: case 2: if (this.b != 0) { if (this.a == 1) { d = this.y + this.ab + 1; } if (this.a == 2) { c = this.y + this.ab + 1; } } break; } } let e = b.height - (c + d); if (e <= 0) { return Rect.empty; } return new Rect(0, b.left, b.top + c, b.width, e); } bk(a) { if (a == null) { return; } let b = 1; let c = 1; if (this.b == 1 || this.bw.width == 1) { b = this.aa - (this.aa * this.w); } else { b = this.aa; } if (this.c == 1 || this.bw.height == 1) { c = this.an - (this.an * this.w); } else { c = this.an; } let d = this.ae; let e = this.y; if (this.b == 2) { if (this.w != 0) { if (this.a == 1) { d = this.ae + ((this.y + this.ab) - 3) * this.w; e = this.y - (this.y - 3) * this.w; } if (this.a == 2) { d = this.ae; e = this.y - (this.y - 3) * this.w; } } } let f = this.am; let g = this.at; if (this.c == 2) { if (this.w != 0) { if (this.d == 2) { f = this.am + ((this.at + this.ao) - 3) * this.w; g = this.at - (this.at - 3) * this.w; } if (this.d == 1) { f = this.am; g = this.at - (this.at - 3) * this.w; } } } let h = this.b2; h._visibility = this.b != 0 ? 0 : 1; h.width = this.ah; h.height = e; h.ad = this.ad; h._fill = this.bl; h._stroke = this.bm; h.ap = this.x; h.aq = this.x; h._opacity = b; let i = this.b3; i._visibility = this.c != 0 ? 0 : 1; i.width = g; i.height = this.al; i.ad = this.ap; i._fill = this.bn; i._stroke = this.bo; i.ap = this.ak; i.aq = this.ak; i._opacity = c; h.n = this.z; h.o = d; i.n = f; i.o = this.aq; if (!this.g) { this.g = true; a.dw.b9(h); } if (!this.m) { this.m = true; a.dw.cc(i); } a.dw.cb(); } bc() { if (!this.f) { this.f = true; this.executionContext.executeDelayed(runOn(this, this.bb), this.a9); } } bb() { if ((+(dateNow()) - +(this.t)) > timeSpanFromMilliseconds(300)) { this.f = false; this.bi(); } else { this.executionContext.executeDelayed(runOn(this, this.bb), truncate(timeSpanTotalMilliseconds((+(dateNow()) - +(this.t))))); } } bi() { if (this.r(this.bt) || this.s(this.bt)) { return; } if (!this.e) { this.e = true; let a = this.animator; a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.ba)); } if (this.w != 1) { this.u = this.w; this.animator.w(); this.animator.v(); } } ba(a, b) { this.w = (1 - this.u) * this.animator.o; this.bk(this.owner); } shouldHandleInteraction(a, b) { let c = { $type: Point_$type, x: a.x + this.bz.left, y: a.y + this.bz.top }; if (this.b != 0) { if (this.p(c, b)) { this.j = true; this.k = true; this.bv = { $type: Point_$type, x: c.x, y: c.y }; this.bu = { $type: Point_$type, x: c.x, y: c.y }; return true; } } if (this.c != 0) { if (this.q(c, b)) { this.j = true; this.k = false; this.bv = { $type: Point_$type, x: c.x, y: c.y }; this.bu = { $type: Point_$type, x: c.x, y: c.y }; return true; } } return false; } onCrosshairMoved(a) { this.bt = { $type: Point_$type, x: a.x, y: a.y }; if (this.r(a) || this.s(a)) { this.bd(); this.bk(this.owner); } else { this.bc(); } } q(a, b) { if (this.c == 0) { return false; } let c = this.v; if (!b) { c = 0; } let d = Math.abs(a.x - this.am) < c || Math.abs(a.y - (this.am + this.at)) < c || (a.x >= this.am && a.x <= (this.am + this.at)); let e = Math.abs(a.y - this.aq) < c || Math.abs(a.y - (this.aq + this.al)) < c || (a.y >= this.aq && a.y <= (this.aq + this.al)); return d && e; } p(a, b) { if (this.b == 0) { return false; } let c = this.v; if (!b) { c = 0; } let d = Math.abs(a.x - this.z) < c || Math.abs(a.y - (this.z + this.ah)) < c || (a.x >= this.z && a.x <= (this.z + this.ah)); let e = Math.abs(a.y - this.ae) < c || Math.abs(a.y - (this.ae + this.y)) < c || (a.y >= this.ae && a.y <= (this.ae + this.y)); return e && d; } s(a) { if (this.c == 0) { return false; } let b = Math.abs(a.x - this.am) < this.v || Math.abs(a.y - (this.am + this.at)) < this.v || (a.x >= this.am && a.x <= (this.am + this.at)); return b; } r(a) { if (this.b == 0) { return false; } let b = Math.abs(a.y - this.ae) < this.v || Math.abs(a.y - (this.ae + this.y)) < this.v || (a.y >= this.ae && a.y <= (this.ae + this.y)); return b; } onScrollbarDrag(a, b) { let c = { $type: Point_$type, x: a.x + this.bz.left, y: a.y + this.bz.top }; let d = c.x - this.bu.x; let e = c.y - this.bu.y; this.bu = { $type: Point_$type, x: c.x, y: c.y }; if (this.k) { this.bg(d); } else { this.bh(e); } } bh(a) { let b = this.by; let c = this.au * 2; let d = b.height - c; let e = a / d; let f = this.owner.yr; let g = new Rect(0, f.left, f.top + e, f.width, f.height); this.owner.za = g; } bg(a) { let b = this.bx; let c = this.ai * 2; let d = b.width - c; let e = a / d; let f = this.owner.yr; let g = new Rect(0, f.left + e, f.top, f.width, f.height); this.owner.za = g; } onScrollbarDragComplete(a, b) { this.j = false; } onScrollbarDragCancel() { this.j = false; } } SeriesViewerScrollbarManager.$t = markType(SeriesViewerScrollbarManager, 'SeriesViewerScrollbarManager', Base.$, [ISeriesViewerScrollbarManager_$type]); SeriesViewerScrollbarManager.aw = DeviceUtils.g(8); SeriesViewerScrollbarManager.a8 = DeviceUtils.g(8); SeriesViewerScrollbarManager.ax = DeviceUtils.g(1); SeriesViewerScrollbarManager.a1 = DeviceUtils.g(0); SeriesViewerScrollbarManager.a0 = DeviceUtils.g(0); SeriesViewerScrollbarManager.a4 = DeviceUtils.g(1); SeriesViewerScrollbarManager.av = DeviceUtils.g(4); SeriesViewerScrollbarManager.a2 = DeviceUtils.g(4); SeriesViewerScrollbarManager.a7 = DeviceUtils.g(0); SeriesViewerScrollbarManager.a6 = DeviceUtils.g(0); SeriesViewerScrollbarManager.bp = BrushUtil.j(255, 120, 120, 120); SeriesViewerScrollbarManager.br = BrushUtil.j(255, 120, 120, 120); SeriesViewerScrollbarManager.bq = BrushUtil.j(255, 120, 120, 120); SeriesViewerScrollbarManager.bs = BrushUtil.j(255, 120, 120, 120); SeriesViewerScrollbarManager.a5 = DeviceUtils.g(1); SeriesViewerScrollbarManager.az = DeviceUtils.g(1); SeriesViewerScrollbarManager.a3 = DeviceUtils.g(0.9); SeriesViewerScrollbarManager.ay = DeviceUtils.g(0.9); return SeriesViewerScrollbarManager; })();