UNPKG

igniteui-react-core

Version:
1,504 lines 50.7 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, markType, INotifyPropertyChanged_$type, PropertyChangedEventArgs, enumGetBox, Point_$type, Boolean_$type } from "./type"; import { IScrollerView_$type } from "./IScrollerView"; import { CanvasGestureDOMEventProxy } from "./CanvasGestureDOMEventProxy"; import { Brush } from "./Brush"; import { DOMExecutionContext } from "./DOMExecutionContext"; import { BaseDOMEventProxy } from "./BaseDOMEventProxy"; import { DoubleAnimator } from "./DoubleAnimator"; import { Rect } from "./Rect"; import { ScrollbarStyle_$type } from "./ScrollbarStyle"; import { truncate, isNaN_ } from "./number"; import { List$1 } from "./List$1"; import { EasingFunctions } from "./EasingFunctions"; import { ScrollerScrollingEventArgs } from "./ScrollerScrollingEventArgs"; /** * @hidden */ export let ScrollerView = /*@__PURE__*/ (() => { class ScrollerView extends Base { constructor(a) { super(); this.i = false; this.k = false; this.ad = null; this.ae = null; this.af = null; this.c = null; this.ag = null; this.ak = null; this.b = null; this.ac = null; this.a = null; this.aj = null; this.ah = null; this.ai = null; this.al = null; this.e = false; this.d = null; this.j = false; this.h = false; this.y = 0; this.v = 0; this.z = -1; this.w = -1; this.g = false; this.f = false; this.x = 0; this.u = 0; this.onDocumentKeyDown = this.onDocumentKeyDown.bind(this); this.onDocumentKeyUp = this.onDocumentKeyUp.bind(this); this.onDocumentMouseDown = this.onDocumentMouseDown.bind(this); this.c = a; } getDefaultScrollbarBrush() { return ((() => { let $ret = new Brush(); $ret.fill = "#666666"; return $ret; })()); } provideContainer(a) { if (a == null) { if (this.ag != null) { this.ag = null; } if (this.a != null) { this.a.aq = null; this.a.ax(); } return; } this.ag = a; this.c.executionContext = new DOMExecutionContext(this.ag); let b = Math.round(this.ag.rootWrapper.width()); let c = Math.round(this.ag.rootWrapper.height()); this.aj = this.ag.rootWrapper; this.aj.setStyleProperty("position", "relative"); this.ak = this.ag.createElement("div"); this.ak.setStyleProperty("position", "relative"); this.ak.setStyleProperty("width", "100%"); this.ak.setStyleProperty("height", "100%"); this.ak.setStyleProperty("overflow", "hidden"); this.ak.addClass("ig-scroll-container"); this.aj.append(this.ak); this.ai = this.ag.createElement("div"); this.ai.setStyleProperty("position", "absolute"); this.ai.setStyleProperty("height", this.c.scrollbarSpan + "px"); this.ai.setStyleProperty("width", this.c.minScrollbarSize + "px"); this.ai.setStyleProperty("background-color", this.c.scrollbarBrush._fill); this.ai.setStyleProperty("display", "none"); this.ai.setStyleProperty("border-radius", "5px"); this.ai.setStyleProperty("z-index", "10000"); this.ai.setStyleProperty("bottom", "0px"); this.aj.append(this.ai); this.al = this.ag.createElement("div"); this.al.setStyleProperty("position", "absolute"); this.al.setStyleProperty("width", this.c.scrollbarSpan + "px"); this.al.setStyleProperty("height", this.c.minScrollbarSize + "px"); this.al.setStyleProperty("background-color", this.c.scrollbarBrush._fill); this.al.setStyleProperty("display", "none"); this.al.setStyleProperty("border-radius", "5px"); this.al.setStyleProperty("z-index", "10000"); this.al.setStyleProperty("right", "0px"); this.aj.append(this.al); this.updateScrollbarStatus(false); this.ac = this.ak.getNativeElement(); this.a = new CanvasGestureDOMEventProxy(this.ag.rootWrapper, this.ag, true); this.ag.rootWrapper.setProperty("tabIndex", 0); this.ag.rootWrapper.setRawStyleProperty("outline", "none"); this.a.dc = true; this.a.by = true; let d = this.a; d.onMouseWheel = delegateCombine(d.onMouseWheel, runOn(this, this.n)); let e = this.a; e.onMouseWheelHorizontal = delegateCombine(e.onMouseWheelHorizontal, runOn(this, this.o)); let f = this.a; f.onMouseLeave = delegateCombine(f.onMouseLeave, runOn(this, this.at)); let g = this.a; g.onDragStarted = delegateCombine(g.onDragStarted, runOn(this, this.ar)); let h = this.a; h.onDragDelta = delegateCombine(h.onDragDelta, runOn(this, this.aq)); let i = this.a; i.onDragCompleted = delegateCombine(i.onDragCompleted, runOn(this, this.ap)); let j = this.a; j.onFlingStarted = delegateCombine(j.onFlingStarted, runOn(this, this.l)); let k = this.a; k.onContactStarted = delegateCombine(k.onContactStarted, runOn(this, this.ao)); let l = this.a; l.onContactMoved = delegateCombine(l.onContactMoved, runOn(this, this.an)); let m = this.a; m.onContactCompleted = delegateCombine(m.onContactCompleted, runOn(this, this.am)); this.a.ac = true; this.a.as = runOn(this, this.t); let n = this.a; n.onKeyDown = delegateCombine(n.onKeyDown, runOn(this, this.m)); let o = this.a; o.onGotFocus = delegateCombine(o.onGotFocus, runOn(this, this.as)); this.ad = runOn(this, this.onDocumentKeyDown); this.ae = runOn(this, this.onDocumentKeyUp); this.af = runOn(this, this.onDocumentMouseDown); document.addEventListener("keydown", this.ad, false); document.addEventListener("keyup", this.ae, false); document.addEventListener("mousedown", this.af, false); this.a.at = (p) => { let e_ = p.originalEvent; let q = (e_.type); if (q == "pointerdown" && !this.a.bu(p)) { return false; } return true; }; this.c.onViewportSizeChanged(b, c); this.c.horizontalAnimation.u(this.ag); this.c.verticalAnimation.u(this.ag); this.attachNativeScroll(); } m(a) { return this.c.ap(a, (this.a.bl & 4) != 0, (this.a.bl & 2) != 0); } as(a) { let b = a.originalEvent ? a.originalEvent.relatedTarget : a.relatedTarget; let c = this.ag.rootWrapper.getNativeElement(); let d = (b instanceof Node && c.contains(b)); if (d) { return; } this.c.dg(this.i, this.k); } onDocumentKeyDown(a) { let b = a; this.i = b.shiftKey; let c = BaseDOMEventProxy.c4(b); if (c == 2) { this.k = true; } } onDocumentKeyUp(a) { let b = a; this.i = b.shiftKey; } onDocumentMouseDown(a) { this.k = false; } t(a, b, c) { if (this.f || this.g) { return true; } if (c || b) { return true; } if (this.p(a, b)) { this.c.c4(); return true; } else if (this.c.isHorizontalActive) { this.c.c8(); } if (this.q(a, b)) { this.c.c5(); return true; } else if (this.c.isVerticalActive) { this.c.c9(); } return false; } am(a, b) { this.f = false; this.g = false; this.c.isDraggingVBar = false; this.c.isDraggingHBar = false; } an(a, b) { if (this.g) { let c = a.y - this.x; this.x = a.y; this.c.dj(c); } else if (this.f) { let d = a.x - this.u; this.u = a.x; this.c.dh(d); } } ao(a, b) { this.e = false; this.cancelInertia(); let c = this.s(a, b); let d = this.r(a, b); if (c) { this.c.isDraggingVBar = true; this.g = true; this.x = a.y; this.focus(); } else if (d) { this.c.isDraggingHBar = true; this.f = true; this.u = a.x; this.focus(); } } r(a, b) { if (!this.h) { return false; } if (a.y >= this.c.viewportHeight - this.c.scrollbarSpan && a.y <= this.c.viewportHeight && a.x >= this.w - this.v / 2 && a.x <= this.w + this.v / 2) { return true; } return false; } s(a, b) { if (!this.j) { return false; } if (a.x >= this.c.viewportWidth - this.c.scrollbarSpan && a.x <= this.c.viewportWidth && a.y >= this.z - this.y / 2 && a.y <= this.z + this.y / 2) { return true; } return false; } p(a, b) { if (!this.h) { return false; } return a.y >= this.c.viewportHeight - this.c.scrollbarSpan - 40 && a.y <= this.c.viewportHeight; } q(a, b) { if (!this.j) { return false; } return a.x >= this.c.viewportWidth - this.c.scrollbarSpan - 40 && a.x <= this.c.viewportWidth; } l(a, b, c) { this.e = true; return true; } onViewportHeightChanged(a) { this.a.bo = new Rect(0, 0, 0, this.c.viewportWidth, this.c.viewportHeight); } onViewportWidthChanged(a) { this.a.bo = new Rect(0, 0, 0, this.c.viewportWidth, this.c.viewportHeight); } onContentHeightChanged(a) { if (this.ah != null) { this.ah.setStyleProperty("height", a + "px"); } } onContentWidthChanged(a) { if (this.ah != null) { this.ah.setStyleProperty("width", a + "px"); } } cancelInertia() { } ap(a) { if (this.f || this.g) { return; } this.e = false; this.c.dd(a); } aq(a) { if (this.f || this.g) { return; } this.c.de(a); } updateScrollTop(a) { this.ac.scrollTop = truncate(a); } ar(a) { if (this.f || this.g) { return; } this.e = false; this.c.df(a); } getInitialScrollLeft() { return this.ac.scrollLeft; } getInitialScrollTop() { return this.ac.scrollTop; } n(a, b) { this.e = false; this.cancelInertia(); return this.c.ar(a, 0, b); } o(a, b) { this.e = false; this.cancelInertia(); return this.c.ar(a, b, 0); } at(a) { if (this.c.horizontalScrollbarStatus > 0) { this.c.c8(); } if (this.c.verticalScrollbarStatus > 0) { this.c.c9(); } } updateScrollLeft(a) { this.ac.scrollLeft = truncate(a); } provideContent(a) { this.ah = a; this.ak.append(this.ah); } requestWork(a) { if (this.ag == null) { return; } if (this.d == null) { this.d = this.ag.getRequestAnimationFrame(); } if (this.e) { a(); } else { this.d(() => a()); } } hideVScrollbar() { if (this.j) { this.j = false; this.al.setStyleProperty("display", "none"); } } hideHScrollbar() { if (this.h) { this.h = false; this.ai.setStyleProperty("display", "none"); } } updateVScrollbar(a, b) { let c = false; if (!this.j) { c = true; this.j = true; this.al.setStyleProperty("display", "block"); } if (a != this.z || c) { this.z = a; if (this.j) { this.al.setRawYPosition(a - b / 2); } } if (b != this.y || c) { this.y = b; if (this.j) { this.al.setRawSize(this.ab(), b); } } } updateHScrollbar(a, b) { let c = false; if (!this.h) { c = true; this.h = true; this.ai.setStyleProperty("display", "block"); } if (a != this.w || c) { this.w = a; if (this.h) { this.ai.setRawXPosition(a - b / 2); } } if (b != this.v || c) { this.v = b; if (this.h) { this.ai.setRawSize(b, this.aa()); } } } updateScrollbarBrush() { if (this.ai != null) { this.ai.setStyleProperty("background-color", this.c.scrollbarBrush._fill); } if (this.al != null) { this.al.setStyleProperty("background-color", this.c.scrollbarBrush._fill); } } updateScrollbarStatus(a) { if (this.ai != null && this.al != null) { switch (this.c.scrollbarStyle) { case 0: if (a) { this.ai.setStyleProperty("opacity", "1"); this.al.setStyleProperty("opacity", "1"); this.ai.setRawSize(this.v, this.aa()); this.al.setRawSize(this.ab(), this.y); } break; case 1: if (a) { this.ai.setRawSize(this.v, this.aa()); this.al.setRawSize(this.ab(), this.y); } this.ai.setStyleProperty("opacity", this.c.horizontalScrollbarStatus.toString()); this.al.setStyleProperty("opacity", this.c.verticalScrollbarStatus.toString()); break; case 2: if (a) { this.ai.setStyleProperty("opacity", "1"); this.al.setStyleProperty("opacity", "1"); } this.ai.setRawSize(this.v, this.aa()); this.al.setRawSize(this.ab(), this.y); break; case 3: this.ai.setStyleProperty("opacity", "0"); this.al.setStyleProperty("opacity", "0"); break; } } } aa() { if (this.c.scrollbarStyle == 2) { return this.c.horizontalScrollbarStatus * (this.c.scrollbarSpan - 2) + 2; } return this.c.scrollbarSpan; } ab() { if (this.c.scrollbarStyle == 2) { return this.c.verticalScrollbarStatus * (this.c.scrollbarSpan - 2) + 2; } return this.c.scrollbarSpan; } focus() { this.ag.rootWrapper.focus(true); } onDetachedFromUI() { if (this.a != null && this.ag != null) { this.a.bk(this.ag.rootWrapper, ""); } if (this.ad != null) { document.removeEventListener("keydown", this.ad, false); this.ad = null; } if (this.ae != null) { document.removeEventListener("keyup", this.ae, false); this.ae = null; } if (this.af != null) { document.removeEventListener("mousedown", this.af, false); this.af = null; } } onAttachedToUI() { if (this.a != null) { this.a.av(this.ag.rootWrapper, ""); } } attachNativeScroll() { let a = this.ak.getNativeElement(); a.addEventListener("scroll", runOn(this, this.onNativeScroll)); } detachNativeScroll() { let a = this.ak.getNativeElement(); a.removeEventListener("scroll", runOn(this, this.onNativeScroll)); } onNativeScroll(a) { } } ScrollerView.$t = /*@__PURE__*/ markType(ScrollerView, 'ScrollerView', Base.$, [IScrollerView_$type]); return ScrollerView; })(); /** * @hidden */ export let Scroller = /*@__PURE__*/ (() => { class Scroller extends Base { constructor() { super(); this.bi = 49; this._keyboardListener = null; this.ba = NaN; this.a4 = 49; this.a2 = NaN; this.bh = 48; this.a9 = NaN; this.a3 = 48; this.a1 = NaN; this.a7 = 0; this.bb = 20; this.be = 8; this.bk = 0; this.dz = null; this.x = false; this.a6 = 0; this.bm = 0; this.bl = 0; this.bg = 0; this.bf = 0; this.c = null; this.v = true; this.ab = false; this.a5 = 0; this.a0 = 0; this.h = 0; this.a8 = 0; this.bj = 0; this.j = null; this.k = null; this.bv = 0; this.b6 = 0; this.bw = 0; this.b7 = 0; this._executionContext = null; this._isDraggingVBar = false; this._isDraggingHBar = false; this.s = false; this.q = false; this.r = false; this.d1 = null; this.p = false; this.propertyChanged = null; this.onScrolling = null; this.onScrollStart = null; this.onScrollStop = null; this._isScrolling = false; this.bc = 0; this.bd = 0; this.w = false; this.az = new List$1(Boolean_$type, 0); this.cc = 500; this.cd = 0; this.ce = 0; this.o = false; this.z = false; this.n = false; this.y = false; this.t = true; this.u = true; this.dz = this.view.getDefaultScrollbarBrush(); this.j = new DoubleAnimator(0, 1, 400); this.k = new DoubleAnimator(0, 1, 400); this.j.b = EasingFunctions.cubicEase; this.k.b = EasingFunctions.cubicEase; let a = this.j; a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.c2)); let b = this.k; b.propertyChanged = delegateCombine(b.propertyChanged, runOn(this, this.c3)); } get smallVerticalChange() { return this.bi; } set smallVerticalChange(a) { let b = this.bi; this.bi = a; if (b != this.bi) { this.di("SmallVerticalChange", b, this.bi); } } get keyboardListener() { return this._keyboardListener; } set keyboardListener(a) { this._keyboardListener = a; } get largeVerticalChange() { return this.ba; } set largeVerticalChange(a) { let b = this.ba; this.ba = a; if (b != this.ba) { this.di("LargeVerticalChange", b, this.ba); } } get br() { return this.a4; } set br(a) { let b = this.a4; this.a4 = a; if (b != this.a4) { this.di("ActualSmallVerticalChange", b, this.a4); } } get bp() { return this.a2; } set bp(a) { let b = this.a2; this.a2 = a; if (b != this.a2) { this.di("ActualLargeVerticalChange", b, this.a2); } } get smallHorizontalChange() { return this.bh; } set smallHorizontalChange(a) { let b = this.bh; this.bh = a; if (b != this.bh) { this.di("SmallHorizontalChange", b, this.bh); } } get largeHorizontalChange() { return this.a9; } set largeHorizontalChange(a) { let b = this.a9; this.a9 = a; if (b != this.a9) { this.di("LargeHorizontalChange", b, this.a9); } } get bq() { return this.a3; } set bq(a) { let b = this.a3; this.a3 = a; if (b != this.a3) { this.di("ActualSmallHorizontalChange", b, this.a3); } } get bo() { return this.a1; } set bo(a) { let b = this.a1; this.a1 = a; if (b != this.a1) { this.di("ActualLargeHorizontalChange", b, this.a1); } } get contentWidth() { return this.a7; } set contentWidth(a) { let b = this.a7; this.a7 = a; if (b != this.a7) { this.di("ContentWidth", b, this.a7); } } get minScrollbarSize() { return this.bb; } set minScrollbarSize(a) { let b = this.bb; this.bb = a; if (b != this.bb) { this.di("MinScrollbarSize", b, this.bb); } } get scrollbarSpan() { return this.be; } set scrollbarSpan(a) { let b = this.be; this.be = a; if (b != this.be) { this.di("ScrollbarSpan", b, this.be); } } ap(a, b, c) { switch (a) { case 11: return this.as(b, c); case 10: return this.at(b, c); case 17: return this.ai(b, c); case 15: return this.ax(b, c); case 14: return this.aq(b, c); case 16: return this.au(b, c); case 13: return this.an(b, c); case 12: return this.aj(b, c); case 2: return this.aw(b, c); case 3: return this.ak(b, c); case 8: return this.al(); case 57: return this.am(); case 9: return this.av(b, c); default: return this.ao(a, b, c); } return false; } av(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onSpace(a, b)) { return true; } } return false; } am() { if (this.keyboardListener != null) { if (this.keyboardListener.onF2()) { return true; } } return false; } al() { if (this.keyboardListener != null) { if (this.keyboardListener.onEscape()) { return true; } } return false; } aw(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onTab(a, b)) { return true; } } return false; } dg(a, b) { if (this.keyboardListener != null) { this.keyboardListener.onGotFocus(a, b); } } aj(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onEnd(a, b)) { return true; } } if (this.scrollTop + this.viewportHeight >= this.contentHeight) { return false; } this.dq(0, this.contentHeight - this.viewportHeight - this.scrollTop); return false; } an(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onHome(a, b)) { return true; } } if (this.scrollTop <= 0) { return false; } this.dq(0, -this.scrollTop); return false; } au(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onRightArrow(a, b)) { return true; } } if (this.scrollLeft + this.viewportWidth >= this.contentWidth) { return false; } this.dq(this.bq, 0); return true; } aq(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onLeftArrow(a, b)) { return true; } } if (this.scrollLeft <= 0) { return false; } this.dq(this.bq * -1, 0); return true; } ax(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onUpArrow(a, b)) { return true; } } if (this.scrollTop <= 0) { return false; } this.dq(0, this.br * -1); return true; } ai(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onDownArrow(a, b)) { return true; } } if (this.scrollTop + this.viewportHeight >= this.contentHeight) { return false; } this.dq(0, this.br); return true; } at(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onPageUp(a, b)) { return true; } } if (this.scrollTop < 0) { return false; } this.dq(0, this.bp * -1); return true; } as(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onPageDown(a, b)) { return true; } } if (this.scrollTop + this.viewportHeight >= this.contentHeight) { return false; } this.dq(0, this.bp); return true; } ak(a, b) { if (this.keyboardListener != null) { if (this.keyboardListener.onEnter(a, b)) { return true; } } return false; } ao(a, b, c) { if (this.keyboardListener != null) { return this.keyboardListener.onKeyDown(a, b, c); } return false; } get verticalTrackStartInset() { return this.bk; } set verticalTrackStartInset(a) { let b = this.bk; this.bk = a; if (b != this.bk) { this.di("VerticalTrackStartInset", b, this.bk); } } get scrollbarBrush() { return this.dz; } set scrollbarBrush(a) { let b = this.dz; this.dz = a; if (b != this.dz) { this.di("ScrollbarBrush", b, this.dz); } } di(a, b, c) { if (this.propertyChanged != null) { this.propertyChanged(this, new PropertyChangedEventArgs(a)); } this.dl(a, b, c); } get ay() { return this.x; } set ay(a) { this.x = a; if (!this.x) { this.view.updateScrollTop(this.scrollTop); this.view.updateScrollLeft(this.scrollLeft); } } dl(a, b, c) { switch (a) { case "ContentWidth": this.view.onContentWidthChanged(this.contentWidth); let d = c; let e = b; if (d < e && this.scrollLeft + this.viewportWidth >= d) { this.dr(d - (this.scrollLeft + this.viewportWidth), 0); } this.dw(); break; case "ContentHeight": this.view.onContentHeightChanged(this.contentHeight); let f = c; let g = b; if (f < g && this.scrollTop > 0 && this.scrollTop + this.viewportHeight >= f) { this.dr(0, f - (this.scrollTop + this.viewportHeight)); } this.dy(); break; case "ScrollTop": if (!this.ay) { this.view.updateScrollTop(this.scrollTop); } break; case "ScrollLeft": if (!this.ay) { this.view.updateScrollLeft(this.scrollLeft); } break; case "ViewportWidth": this.view.onViewportWidthChanged(this.viewportWidth); if (isNaN_(this.largeVerticalChange)) { this.bo = this.viewportWidth; } if (this.contentWidth > 0 && this.scrollLeft + this.viewportWidth > this.contentWidth) { this.dr(this.contentWidth - this.viewportWidth - this.scrollLeft, 0); } this.dw(); if (this.view.getInitialScrollLeft() != this.scrollLeft) { this.view.updateScrollLeft(this.scrollLeft); } break; case "ViewportHeight": this.view.onViewportHeightChanged(this.viewportHeight); if (isNaN_(this.largeVerticalChange)) { this.bp = this.viewportHeight; } this.dy(); if (this.view.getInitialScrollTop() != this.scrollTop) { this.view.updateScrollTop(this.scrollTop); } break; case "ScrollbarBrush": this.view.updateScrollbarBrush(); break; case "ScrollbarSpan": case "MinScrollbarSize": case "VerticalTrackStartInset": this.dy(); this.dw(); break; case "HorizontalScrollbarStatus": case "VerticalOpacity": this.view.updateScrollbarStatus(false); break; case "ScrollbarStyle": this.view.updateScrollbarStatus(true); break; } } get contentHeight() { return this.a6; } set contentHeight(a) { let b = this.a6; this.a6 = a; if (b != this.a6) { this.di("ContentHeight", b, this.a6); } } dj(a) { let b = Math.max(this.minScrollbarSize, this.actualVerticalScrollbarHeight); let c = this.verticalTrackStartInset + (b / 2); let d = this.viewportHeight - (b / 2); let e = a / (d - c); let f = e * (this.contentHeight - this.viewportHeight); this.dq(0, f); } dh(a) { let b = Math.max(this.minScrollbarSize, this.actualHorizontalScrollbarWidth); let c = 0 + (b / 2); let d = this.viewportWidth - (b / 2); let e = a / (d - c); let f = e * (this.contentWidth - this.viewportWidth); this.dq(f, 0); } onViewportSizeChanged(a, b, c = false) { let d = this.bm; let e = this.bl; this.bm = a; this.bl = b; if (!isNaN_(this.contentWidth) && this.contentWidth != 0 && this.scrollLeft > 0 && this.scrollLeft + this.bm > this.contentWidth) { this.dq(0, 0); } if (!isNaN_(this.contentHeight) && this.contentHeight != 0 && this.scrollTop > 0 && this.scrollTop + this.bl > this.contentHeight) { this.dq(0, 0); } if (c && (d != a || e != b)) { this.di("ViewportWidth", d, a); this.di("ViewportHeight", e, b); } } get viewportWidth() { return this.bm; } set viewportWidth(a) { let b = this.bm; this.bm = a; if (b != this.bm) { this.di("ViewportWidth", b, this.bm); } } get viewportHeight() { return this.bl; } set viewportHeight(a) { let b = this.bl; this.bl = a; if (b != this.bl) { this.di("ViewportHeight", b, this.bl); } } get scrollTop() { return this.bg; } set scrollTop(a) { let b = this.bg; this.bg = a; if (b != this.bg) { this.di("ScrollTop", b, this.bg); } } get scrollLeft() { return this.bf; } set scrollLeft(a) { let b = this.bf; this.bf = a; if (b != this.bf) { this.di("ScrollLeft", b, this.bf); } } get view() { if (this.c == null) { this.c = new ScrollerView(this); } return this.c; } set view(a) { this.c = a; } provideContainer(a) { this.view.provideContainer(a); this.bg = this.view.getInitialScrollTop(); this.bf = this.view.getInitialScrollLeft(); this.dw(); this.dy(); } onDetachedFromUI() { this.view.onDetachedFromUI(); } onAttachedToUI() { this.view.onAttachedToUI(); } provideContent(a) { this.view.provideContent(a); } ar(a, b, c) { this.r = false; this.q = false; this.s = false; this.view.cancelInertia(); if (this.keyboardListener != null) { this.keyboardListener.onWheel(); } this.dq(b, c); return true; } get lockScrollDirection() { return this.v; } set lockScrollDirection(a) { this.v = true; } get actualVerticalScrollbarHeight() { return this.a5; } set actualVerticalScrollbarHeight(a) { let b = this.a5; this.a5 = a; if (b != this.a5) { this.di("ActualVerticalScrollbarHeight", b, this.a5); } } get actualHorizontalScrollbarWidth() { return this.a0; } set actualHorizontalScrollbarWidth(a) { let b = this.a0; this.a0 = a; if (b != this.a0) { this.di("ActualHorizontalScrollbarWidth", b, this.a0); } } get scrollbarStyle() { return this.h; } set scrollbarStyle(a) { let b = this.h; this.h = a; if (b != this.h) { this.di("ScrollbarStyle", enumGetBox(ScrollbarStyle_$type, b), enumGetBox(ScrollbarStyle_$type, this.h)); } } get horizontalScrollbarStatus() { return this.a8; } set horizontalScrollbarStatus(a) { let b = this.a8; this.a8 = a; if (b != this.a8) { this.di("HorizontalScrollbarStatus", b, this.a8); } } get verticalScrollbarStatus() { return this.bj; } set verticalScrollbarStatus(a) { let b = this.bj; this.bj = a; if (b != this.bj) { this.di("VerticalOpacity", b, this.bj); } } get horizontalAnimation() { return this.j; } get verticalAnimation() { return this.k; } get executionContext() { return this._executionContext; } set executionContext(a) { this._executionContext = a; } get isVerticalActive() { return this.y; } get isHorizontalActive() { return this.n; } get isDraggingVBar() { return this._isDraggingVBar; } set isDraggingVBar(a) { this._isDraggingVBar = a; } get isDraggingHBar() { return this._isDraggingHBar; } set isDraggingHBar(a) { this._isDraggingHBar = a; } focus() { this.view.focus(); } df(a) { this.view.focus(); this.s = false; this.q = false; this.r = false; this.p = true; this.d1 = { $type: Point_$type, x: a.x, y: a.y }; } de(a) { if (this.p) { let b = a.y - this.d1.y; let c = a.x - this.d1.x; if (this.lockScrollDirection && !this.r) { this.r = true; if (b > 0 || c > 0) { if (b > c) { this.s = true; } else { this.s = true; } } } this.d1 = { $type: Point_$type, x: a.x, y: a.y }; this.dq(-c, -b); } } get isScrolling() { return this._isScrolling; } set isScrolling(a) { this._isScrolling = a; } scrollTo(a, b) { this.view.detachNativeScroll(); this.bc = a - this.scrollLeft; this.bd = b - this.scrollTop; this.dp(); } dq(a, b) { this.view.detachNativeScroll(); this.bc += a; this.bd += b; this.dp(); } dr(a, b) { this.view.detachNativeScroll(); this.bc += a; this.bd += b; this.dv(); } dp() { if (this.w) { return; } this.w = true; this.view.requestWork(runOn(this, this.dv)); } dv() { this.w = false; let a = this.bc; let b = this.bd; this.bc = 0; this.bd = 0; if (this.r) { if (this.s) { a = 0; } if (this.q) { b = 0; } } if (a != 0) { this.t = false; this.c4(); this.c8(); this.t = true; } if (b != 0) { this.u = false; this.c5(); this.c9(); this.u = true; } let c = Math.round(this.scrollTop + b); let d = Math.round(this.scrollLeft + a); if (c < 0) { c = 0; if (b == 0) { this.view.cancelInertia(); } } if (d < 0) { d = 0; if (a == 0) { this.view.cancelInertia(); } } if (c + this.viewportHeight > this.contentHeight) { c = this.contentHeight - this.viewportHeight; if (c < 0) { c = 0; } if (a == 0) { this.view.cancelInertia(); } } if (d + this.viewportWidth > this.contentWidth) { d = this.contentWidth - this.viewportWidth; if (d < 0) { d = 0; } if (b == 0) { this.view.cancelInertia(); } } b = c - this.scrollTop; a = d - this.scrollLeft; if (b != 0 || a != 0) { try { this.ay = true; this.ab = true; this.scrollTop = c; this.scrollLeft = d; this.dy(); this.dw(); this.ab = false; if (!this.isScrolling) { this.isScrolling = true; if (this.onScrollStart != null) { this.onScrollStart(this, ((() => { let $ret = new ScrollerScrollingEventArgs(); $ret.deltaX = a; $ret.deltaY = b; return $ret; })())); } } if (this.onScrolling != null) { this.onScrolling(this, ((() => { let $ret = new ScrollerScrollingEventArgs(); $ret.deltaX = a; $ret.deltaY = b; return $ret; })())); } if (this.az.count > 0) { this.az._inner[this.az.count - 1] = false; } this.az.add(true); this.executionContext.executeDelayed(() => { if (this.az._inner[0]) { if (this.onScrollStop != null) { this.onScrollStop(this, ((() => { let $ret = new ScrollerScrollingEventArgs(); $ret.deltaX = a; $ret.deltaY = b; return $ret; })())); } this.isScrolling = false; this.view.attachNativeScroll(); } this.az.removeAt(0); }, 50); } finally { this.ay = false; } } } dy() { if (isNaN_(this.contentHeight)) { return; } this.dx(this.contentHeight, this.viewportHeight, this.scrollTop, true); } dw() { if (isNaN_(this.contentWidth)) { return; } this.dx(this.contentWidth, this.viewportWidth, this.scrollLeft, false); } aa(a, b) { if (Math.abs(a - b) <= 2) { return true; } return false; } dx(a, b, c, d) { if (b == 0 || a == 0) { return; } let e = Math.round((b / a) * b); let f = d ? this.verticalTrackStartInset : 0; e = e - f; if (e < this.minScrollbarSize) { e = this.minScrollbarSize; } if (e >= (b - f) || this.aa(e, b - f)) { if (d) { this.view.hideVScrollbar(); } else { this.view.hideHScrollbar(); } return; } let g = f + (e / 2); let h = b - (e / 2); let i = c / (a - b); let j = Math.round(g + (h - g) * i); if (d) { this.actualVerticalScrollbarHeight = e; this.view.updateVScrollbar(j, e); } else { this.actualHorizontalScrollbarWidth = e; this.view.updateHScrollbar(j, e); } } dd(a) { this.r = false; this.q = false; this.s = false; this.p = false; } c2(a, b) { this.horizontalScrollbarStatus = this.bv + this.j.o * (this.b6 - this.bv); } c3(a, b) { this.verticalScrollbarStatus = this.bw + this.k.o * (this.b7 - this.bw); } c4() { if (this.n) { return; } if (this.scrollbarStyle == 1 || this.scrollbarStyle == 2) { if (this.j.f()) { this.j.w(); } this.horizontalScrollbarStatus = 1; if (this.o && this.t) { this.o = false; } } this.n = true; } c5() { if (this.y) { return; } if (this.scrollbarStyle == 1 || this.scrollbarStyle == 2) { if (this.k.f()) { this.k.w(); } this.verticalScrollbarStatus = 1; if (this.z && this.u) { this.z = false; } } this.y = true; } c8() { if (!this.n || this.isDraggingHBar) { return; } if (this.scrollbarStyle == 1 || this.scrollbarStyle == 2) { this.dt(); } this.n = false; } c9() { if (!this.y || this.isDraggingVBar) { return; } if (this.scrollbarStyle == 1 || this.scrollbarStyle == 2) { this.du(); } this.y = false; } dt() { if (!this.o) { this.o = true; this.cd = this.executionContext.getCurrentRelativeTime(); this.executionContext.executeDelayed(runOn(this, this.c6), this.cc); } else { this.cd = this.executionContext.getCurrentRelativeTime(); } } du() { if (!this.z) { this.z = true; this.ce = this.executionContext.getCurrentRelativeTime(); this.executionContext.executeDelayed(runOn(this, this.c7), this.cc); } else { this.ce = this.executionContext.getCurrentRelativeTime(); } } c6() { if (!this.o) { return; } let a = this.executionContext.getCurrentRelativeTime(); if (a - this.cd >= this.cc) { if (!this.j.f() && this.horizontalScrollbarStatus != 0) { this.bv = this.horizontalScrollbarStatus; this.b6 = 0; this.j.v(); } this.o = false; } else { this.executionContext.executeDelayed(runOn(this, this.c6), (this.cc - (a - this.cd))); } } c7()