UNPKG

scichart

Version:

Fast WebGL JavaScript Charting Library and Framework

122 lines (121 loc) 5.29 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.SciChartSurfaceCore = void 0; var DeletableEntity_1 = require("../../Core/DeletableEntity"); var EventHandler_1 = require("../../Core/EventHandler"); var Globals_1 = require("../../Core/Globals"); var Size_1 = require("../../types/Size"); var SurfaceType_1 = require("../../types/SurfaceType"); var guid_1 = require("../../utils/guid"); var logger_1 = require("../../utils/logger"); var performance_1 = require("../../utils/performance"); var SciChartSurfaceCore = /** @class */ (function (_super) { __extends(SciChartSurfaceCore, _super); function SciChartSurfaceCore(canvases) { var _this = _super.call(this) || this; /** * An event handler which notifies its subscribers when a render operation starts. Use this * to update elements of the chart for the current render. Any updates made here will not trigger a subsequent render. */ _this.preRender = new EventHandler_1.EventHandler(); /** * An event handler which notifies its subscribers when a render operation has finished. Use this * to time render performance, or to update elements of the chart or your UI on redraw. */ _this.rendered = new EventHandler_1.EventHandler(); /** * An event handler which notifies its subscribers when a chart was visually painted a display canvas. * @remarks Not applicable to sub-charts */ _this.painted = new EventHandler_1.EventHandler(); _this.resized = new EventHandler_1.EventHandler(); _this.idProperty = (0, guid_1.generateGuid)(); _this.isDeletedProperty = false; _this.deletables = []; _this.domChartRoot = canvases.domChartRoot; _this.domCanvas2D = canvases.domCanvas2D; _this.domSvgContainer = canvases.domSvgContainer; _this.domSvgAdornerLayer = canvases.domSvgAdornerLayer; _this.domDivContainer = canvases.domDivContainer; _this.domBackgroundSvgContainer = canvases.domBackgroundSvgContainer; return _this; } Object.defineProperty(SciChartSurfaceCore.prototype, "id", { /** * Gets or sets the SciChartSurface Id */ get: function () { return this.idProperty; }, /** * Gets or sets the SciChartSurface Id */ set: function (value) { this.idProperty = value; }, enumerable: false, configurable: true }); Object.defineProperty(SciChartSurfaceCore.prototype, "isDeleted", { /** * Used internally - gets isDeleted flag */ get: function () { return this.isDeletedProperty; }, enumerable: false, configurable: true }); Object.defineProperty(SciChartSurfaceCore.prototype, "otherSurfaces", { /** * Used internally - gets other SciChartSurfaces */ get: function () { return this.getOtherSurfaces(); }, enumerable: false, configurable: true }); /** * @inheritDoc */ SciChartSurfaceCore.prototype.addDeletable = function (deletable) { this.deletables.push(deletable); }; SciChartSurfaceCore.prototype.onResize = function (width, height) { performance_1.PerformanceDebugHelper.mark(performance_1.EPerformanceMarkType.Resize, { contextId: this.id }); logger_1.Logger.debug("onResize", width, height); this.changeViewportSize(width, height); this.resized.raiseEvent(new Size_1.Size(width, height)); }; SciChartSurfaceCore.prototype.getOtherSurfaces = function () { var otherDestinations; if ((0, SurfaceType_1.getIs2DSurfaceType)(this.surfaceType)) { otherDestinations = (0, Globals_1.getOther2DDestinations)(this); } else if ((0, SurfaceType_1.getIs3DSurfaceType)(this.surfaceType)) { otherDestinations = (0, Globals_1.getOther3DDestinations)(this); } else { otherDestinations = (0, Globals_1.getOtherPieDestinations)(this); } return otherDestinations.map(function (dest) { return dest.sciChartSurface; }); }; return SciChartSurfaceCore; }(DeletableEntity_1.DeletableEntity)); exports.SciChartSurfaceCore = SciChartSurfaceCore;