Blame view

js/app/views/PlotComponents/PlotTextForm.js 2.76 KB
a8c54fb9   Benjamin Renard   Add text object p...
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
/**
 * Project   : AMDA-NG
 * Name      : PlotTextForm.js
 * @class   amdaPlotComp.PlotTextForm
 * @extends amdaPlotComp.PlotStandardForm
 * @brief   Form to define specifics Text object options
 * @author  Benjamin Renard
 * @version $Id: PlotTextForm.js benjamin $
 */

Ext.define('amdaPlotComp.PlotTextForm', {
	extend: 'amdaPlotComp.PlotStandardForm',
	
	setObject : function(object) {
		this.object = object;
		if (this.object != null)
		{
			this.loadRecord(this.object);
			this.updateOptions(this.crtTree.getSelectedPlotType());
		}
	},
	
	updateOptions: function(plotType) {
		var xRelativeField = this.getForm().findField('text-x-relative');
		var xFloatValueField = this.getForm().findField('text-x-floatvalue');
		var xTimeValueField = this.getForm().findField('text-x-timevalue');
		var yRelativeField = this.getForm().findField('text-y-relative');
		var yValueField = this.getForm().findField('text-y-value');
		var yAxisField = this.getForm().findField('text-y-axis');
		
		var isTimePlot = (plotType == 'timePlot');
		
		if (xRelativeField.getValue())
		{
			xFloatValueField.setMinValue(0);
			xFloatValueField.setMaxValue(1);
		}
		else
		{
			xFloatValueField.setMinValue(-Number.MAX_VALUE);
			xFloatValueField.setMaxValue(Number.MAX_VALUE);
		}
		
		xFloatValueField.setVisible(!(isTimePlot && !xRelativeField.getValue()));
		xTimeValueField.setVisible(isTimePlot && !xRelativeField.getValue());
		
		if (yRelativeField.getValue())
		{
			yAxisField.setVisible(false);
			yValueField.setMinValue(0);
			yValueField.setMaxValue(1);
		}
		else
		{
			yAxisField.setVisible(true);
			yValueField.setMinValue(-Number.MAX_VALUE);
			yValueField.setMaxValue(Number.MAX_VALUE);
		}
	},
	
	getFormItems: function() {
		var me = this;
		return [
		        this.addStandardText('text-value', 'Text'),
4f728fd9   Erdogan Furkan   For now 2
65
66
			this.addColorsPicker('text-color', 'Color', amdaDefaultConfigs.availableColorsNew),
		        this.addStandardCombo('text-align', 'Alignment', amdaDefaultConfigs.availableTextAlignments),
a8c54fb9   Benjamin Renard   Add text object p...
67
68
69
70
		        this.addStandardCheck('text-x-relative', 'Relative X Position', function(name, value, oldValue) {
		        	me.updateOptions(me.crtTree.getSelectedPlotType());
		        }),
		        this.addStandardFloat('text-x-floatvalue', 'X Position', 0, 1),
dbb7bcbe   Benjamin Renard   Add curves defint...
71
		        this.addStandardDate('text-x-timevalue', 'X Position'),
a8c54fb9   Benjamin Renard   Add text object p...
72
73
74
		        this.addStandardCheck('text-y-relative', 'Relative Y Position', function(name, value, oldValue) {
		        	me.updateOptions(me.crtTree.getSelectedPlotType());
		        }),
4f728fd9   Erdogan Furkan   For now 2
75
		        this.addStandardCombo('text-y-axis', 'Y Axis attachment', amdaDefaultConfigs.availableYAxes),
a8c54fb9   Benjamin Renard   Add text object p...
76
77
78
79
80
		        this.addStandardFloat('text-y-value', 'Y Position', 0, 1),
		        this.addStandardFloat('text-angle', 'Rotation Angle', 0, 360),
		        this.addStandardFont('text-font')
        ];
	}
f34c9c5a   Benjamin Renard   Finalize color pi...
81
});