igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
211 lines (210 loc) • 7.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 { 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
*/
export let SeriesViewerSurfaceViewer = /*@__PURE__*/ (() => {
class SeriesViewerSurfaceViewer extends DependencyObject {
constructor(a, b) {
super();
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;
let c = this.l;
c.windowRectChanged = delegateCombine(c.windowRectChanged, runOn(this, this.u));
this.m = b;
this.x = new Canvas();
this.w();
}
u(a, b) {
let c = this.o;
this.o = true;
this.zoomLevel = 1 - Math.min(b.newRect.height, b.newRect.width);
this.o = c;
}
get l() {
return this.k;
}
set l(a) {
if (this.k != null) {
let 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) {
let c = typeCast(INotifyPropertyChanged_$type, this.k);
if (c != null) {
c.propertyChanged = delegateCombine(c.propertyChanged, runOn(this, this.t));
}
}
}
t(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));
}
}
zoomTo100() {
this.l.wl = XamDataChart.wg;
}
scaleToFit() {
this.l.wl = XamDataChart.wg;
}
renderPreview() {
if (!this.isDirty) {
return;
}
let a = new RenderSurface();
a.a = this.m.n.viewThumbnailContext;
if (a.a != null && a.a.d) {
let b = this.m.n.viewThumbnailSize;
this.m.cb(b.width, b.height, a);
}
this.isDirty = false;
}
get worldRect() {
return XamDataChart.wg;
}
get viewportRect() {
return this.l.wk;
}
get minimumZoomLevel() {
return 0;
}
get maximumZoomLevel() {
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);
}
}
get isDirty() {
return this.n;
}
set isDirty(a) {
this.n = a;
}
get isIsoScaled() {
if (this.k == null) {
return false;
}
return this.k.fb;
}
v(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;
}
let d = this.l != null && this.l.c2 != null && this.l.c2.updatingSliderRanges;
if (!this.o && !d) {
let e = 1 - this.zoomLevel;
let f = RectUtil.l(this.l.v4);
let 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;
}
}
w() {
let a = Math.round(100 * (1 / (1 - this.zoomLevel)));
if (a <= 1000) {
this.zoomLevelDisplayText = a.toString();
}
else {
this.zoomLevelDisplayText = "> 1000";
}
}
get zoomLevelDisplayText() {
return this.q;
}
set zoomLevelDisplayText(a) {
let b = this.zoomLevelDisplayText != a;
if (b) {
let c = this.zoomLevelDisplayText;
this.q = a;
this.v("ZoomLevelDisplayText", c, a);
}
}
get defaultInteraction() {
return this.j;
}
set defaultInteraction(a) {
this.j = a;
this.l.cw = a;
}
static z(a, b, c, d, e) {
let 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;
}
let j = f + h;
let k = g + i;
let l = Math.max(0, e.left - f);
let m = Math.max(0, j - e.right);
let n = Math.max(0, e.top - g);
let o = Math.max(0, k - e.bottom);
f += l - m;
g += n - o;
let 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;
})();