/** * Project  : AMDA-NG * Name : PlotZoomPlug.js * @plugin amdaPlotComp.PlotZoomPlug * @extends Ext.util.Observable * @ptype plotZoomPlugin * @brief Plot Zoom UI (View) * @author Benjamin * @version $Id: PlotZoomPlug.js ******************************************************************************** * FT Id : Date : Name - Description ******************************************************************************* * : */ Ext.define('amdaPlotComp.PlotZoomPlug', { extend: 'Ext.util.Observable', alias: 'plugin.plotZoomPlugin', requires: ['amdaPlotComp.intervalSelection.IntervalSelection'], win: null, zoomType: '', interactiveId: '', panelId: -1, constructor: function (config) { Ext.apply(this, config); this.callParent(arguments); }, onDestroy: function () { this.win = null; }, init: function (cmp) { this.hostCmp = cmp; }, setMinValue: function (min) { if (!this.win) return; this.win.setField1Value(min); }, setMaxValue: function (max) { if (!this.win) return; this.win.setField2Value(max); }, /** * creation of the window */ show: function (interactiveId, zoomType, panelId) { this.zoomType = zoomType; this.panelId = panelId; this.interactiveId = interactiveId; let config = { id: 'plot-zoom-win-' + this.hostCmp.ownerCt.getId(), interactiveId: interactiveId, panelId: panelId, hostCmp: this.hostCmp, renderTo: this.hostCmp.ownerCt.body, listeners: { scope: this, beforeclose: function () { this.hostCmp.panelImage.hidePanelMarker(); this.hostCmp.panelImage.stopZoom(); }, show: function (win, eOpts) { this.hostCmp.panelImage.showPanelMarker(panelId); } }, getConstrainVector: function (constrainTo) { var me = this; if (me.constrain || me.constrainHeader) { constrainTo = constrainTo || (me.floatParent && me.floatParent.getTargetEl()) || me.container || me.el.getScopeParent(); return (me.constrainHeader ? me.header.el : me.el).getConstrainVector(constrainTo); } } }; if (this.win) { this.close() }; let winType; switch (this.zoomType) { case 'timeAxis': winType = 'amdaPlotComp.intervalSelection.DateZoomIntervalSelection'; break; case 'y-left': case 'y-right': case 'xaxis_id': winType = 'amdaPlotComp.intervalSelection.NumberZoomIntervalSelection'; let title = ""; if (this.zoomType === 'y-left') { title = 'Zoom on Y Left axis'; } else if (this.zoomType === 'y-right') { title = 'Zoom on Y Right axis'; } else { title = 'Zoom on X axis'; } config["type"] = this.zoomType; config["title"] = title; break; case 'plotFunction': winType = 'amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection'; break; } this.win = Ext.create(winType, config); this.win.on('destroy', this.onDestroy, this); this.win.show(); }, close: function () { if (this.win == null) return; this.win.close(); }, resetMinMaxValue: function () { this.win.reset(); } });