UNPKG

igniteui-angular-charts

Version:

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

249 lines (248 loc) 9.3 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 { __extends } from "tslib"; import { DependencyObject } from "igniteui-angular-core"; import { IOverviewPlusDetailControl_$type } from "igniteui-angular-core"; import { INotifyPropertyChanged_$type, PropertyChangedEventArgs, runOn, delegateCombine, typeCast, delegateRemove, enumGetBox, markType, markDep } from "igniteui-angular-core"; import { Canvas } from "igniteui-angular-core"; import { Rect } from "igniteui-angular-core"; import { DependencyProperty } from "igniteui-angular-core"; import { InteractionState_$type } from "igniteui-angular-core"; import { ArgumentNullException } from "igniteui-angular-core"; import { RenderSurface } from "./RenderSurface"; import { RectUtil } from "igniteui-angular-core"; import { PropertyMetadata } from "igniteui-angular-core"; import { XamDataChart } from "./XamDataChart"; /** * @hidden */ var SeriesViewerSurfaceViewer = /** @class */ /*@__PURE__*/ (function (_super) { __extends(SeriesViewerSurfaceViewer, _super); function SeriesViewerSurfaceViewer(a, b) { var _this = _super.call(this) || this; _this.m = null; _this.o = false; _this.k = null; _this.x = null; _this.n = true; _this.q = null; _this.j = 0; _this.propertyChanged = null; if (a == null || b == null) { throw new ArgumentNullException(0, "model"); } _this.l = a; var c = _this.l; c.windowRectChanged = delegateCombine(c.windowRectChanged, runOn(_this, _this.u)); _this.m = b; _this.x = new Canvas(); _this.w(); return _this; } SeriesViewerSurfaceViewer.prototype.u = function (a, b) { var c = this.o; this.o = true; this.zoomLevel = 1 - Math.min(b.newRect.height, b.newRect.width); this.o = c; }; Object.defineProperty(SeriesViewerSurfaceViewer.prototype, "l", { get: function () { return this.k; }, set: function (a) { if (this.k != null) { var b = typeCast(INotifyPropertyChanged_$type, this.k); if (b != null) { b.propertyChanged = delegateRemove(b.propertyChanged, runOn(this, this.t)); } } this.k = a; if (this.k != null) { var c = typeCast(INotifyPropertyChanged_$type, this.k); if (c != null) { c.propertyChanged = delegateCombine(c.propertyChanged, runOn(this, this.t)); } } }, enumerable: false, configurable: true }); SeriesViewerSurfaceViewer.prototype.t = function (a, b) { if (b.propertyName == "DefaultInteraction") { this.j = this.l.cw; this.v(b.propertyName, enumGetBox(InteractionState_$type, this.defaultInteraction), enumGetBox(InteractionState_$type, this.defaultInteraction)); } }; SeriesViewerSurfaceViewer.prototype.zoomTo100 = function () { this.l.wl = XamDataChart.wg; }; SeriesViewerSurfaceViewer.prototype.scaleToFit = function () { this.l.wl = XamDataChart.wg; }; SeriesViewerSurfaceViewer.prototype.renderPreview = function () { if (!this.isDirty) { return; } var a = new RenderSurface(); a.a = this.m.n.viewThumbnailContext; if (a.a != null && a.a.d) { var b = this.m.n.viewThumbnailSize; this.m.cb(b.width, b.height, a); } this.isDirty = false; }; Object.defineProperty(SeriesViewerSurfaceViewer.prototype, "worldRect", { get: function () { return XamDataChart.wg; }, enumerable: false, configurable: true }); Object.defineProperty(SeriesViewerSurfaceViewer.prototype, "viewportRect", { get: function () { return this.l.wk; }, enumerable: false, configurable: true }); Object.defineProperty(SeriesViewerSurfaceViewer.prototype, "minimumZoomLevel", { get: function () { return 0; }, enumerable: false, configurable: true }); Object.defineProperty(SeriesViewerSurfaceViewer.prototype, "maximumZoomLevel", { get: function () { if (this.l.hm == 0.0001 && this.l.hl == 0.0001) { return 0.9; } else { return 1 - Math.max(this.l.hm, this.l.hl); } }, enumerable: false, configurable: true }); Object.defineProperty(SeriesViewerSurfaceViewer.prototype, "isDirty", { get: function () { return this.n; }, set: function (a) { this.n = a; }, enumerable: false, configurable: true }); Object.defineProperty(SeriesViewerSurfaceViewer.prototype, "isIsoScaled", { get: function () { if (this.k == null) { return false; } return this.k.fb; }, enumerable: false, configurable: true }); SeriesViewerSurfaceViewer.prototype.v = function (a, b, c) { if (this.propertyChanged != null) { this.propertyChanged(this, new PropertyChangedEventArgs(a)); } switch (a) { case SeriesViewerSurfaceViewer.$$p[0]: if (c - this.minimumZoomLevel < -1E-05) { this.zoomLevel = this.minimumZoomLevel; return; } if (c - this.maximumZoomLevel > 0.0001) { this.zoomLevel = this.maximumZoomLevel; return; } var d = this.l != null && this.l.c2 != null && this.l.c2.updatingSliderRanges; if (!this.o && !d) { var e = 1 - this.zoomLevel; var f = RectUtil.l(this.l.v4); var g = new Rect(0, f.x - e / 2, f.y - e / 2, e, e); this.l.wl = SeriesViewerSurfaceViewer.z(this.l.wl, g, this.l.fl(), this.l.fm(), this.worldRect); } this.w(); if (this.l.c2 != null) { this.l.c2.pushZoomLevel(this.zoomLevel); } break; } }; SeriesViewerSurfaceViewer.prototype.w = function () { var a = Math.round(100 * (1 / (1 - this.zoomLevel))); if (a <= 1000) { this.zoomLevelDisplayText = a.toString(); } else { this.zoomLevelDisplayText = "> 1000"; } }; Object.defineProperty(SeriesViewerSurfaceViewer.prototype, "zoomLevelDisplayText", { get: function () { return this.q; }, set: function (a) { var b = this.zoomLevelDisplayText != a; if (b) { var c = this.zoomLevelDisplayText; this.q = a; this.v("ZoomLevelDisplayText", c, a); } }, enumerable: false, configurable: true }); Object.defineProperty(SeriesViewerSurfaceViewer.prototype, "defaultInteraction", { get: function () { return this.j; }, set: function (a) { this.j = a; this.l.cw = a; }, enumerable: false, configurable: true }); SeriesViewerSurfaceViewer.z = function (a, b, c, d, e) { var f, g, h, i; if (c) { f = b.left; h = b.width; } else { f = a.left; h = a.width; } if (d) { g = b.top; i = b.height; } else { g = a.top; i = a.height; } var j = f + h; var k = g + i; var l = Math.max(0, e.left - f); var m = Math.max(0, j - e.right); var n = Math.max(0, e.top - g); var o = Math.max(0, k - e.bottom); f += l - m; g += n - o; var p = new Rect(0, f, g, h, i); p.intersect(e); return p; }; SeriesViewerSurfaceViewer.$t = markType(SeriesViewerSurfaceViewer, 'SeriesViewerSurfaceViewer', DependencyObject.$, [IOverviewPlusDetailControl_$type, INotifyPropertyChanged_$type]); SeriesViewerSurfaceViewer.$$p = markDep(DependencyProperty, PropertyMetadata, SeriesViewerSurfaceViewer, 'v', ['ZoomLevel::y', [1, 0]]); return SeriesViewerSurfaceViewer; }(DependencyObject)); export { SeriesViewerSurfaceViewer };