PlotZoomPlug.js
3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/**
* 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();
}
});