diff --git a/js/app/views/PlotComponents/PlotColorAxisForm.js b/js/app/views/PlotComponents/PlotColorAxisForm.js index 9a5cd8b..a756389 100644 --- a/js/app/views/PlotComponents/PlotColorAxisForm.js +++ b/js/app/views/PlotComponents/PlotColorAxisForm.js @@ -15,68 +15,11 @@ Ext.define('amdaPlotComp.PlotColorAxisForm', { showTickGridOptions : false, getFormItems: function() { - var data = []; - amdaPlotObj.PlotObjectConfig.availableColorMaps.forEach(function(color){ - data.push({key:color.key,name:color.value, iconUrl:'generic_data/colormaps/'+ color.svgFile}) - }); - - var combo = new Ext.form.ComboBox({ - name: 'axis-color-map', - fieldLabel: 'Colour Map <img amda_clicktip="colourMaps" style="vertical-align:bottom" src="js/resources/images/16x16/info_mini.png"', - store: new Ext.data.Store({ - fields: ['key','name', 'iconUrl'], - data: data - }), - displayField: 'name', - valueField: 'key', - tpl: '<tpl for="."><div class="x-boundlist-item"><span data-qtip="{name}"> \ - <img src="{iconUrl}" class="svg-icon" style="height: 26px;"> \ - </span>\ - </div></tpl>', - editable: false, - queryMode: 'local', - listeners: { - change: function (combo, newValue, oldValue, eOpts) { - var iconUrl=""; - var colorName = ""; - data.forEach(function(colorData){ - if(colorData.key == newValue ){ - iconUrl= colorData.iconUrl; - colorName = colorData.name; - } - }); - combo.inputEl.setStyle('background-image', 'url(' + iconUrl + ')'); - combo.inputEl.setStyle('background-size', '100%'); - combo.inputEl.setStyle('background-repeat', 'no-repeat'); - combo.inputEl.setStyle('background-position', 'center'); - combo.inputEl.setStyle('font-size', '0'); - - combo.inputEl.set({ "data-qtip": Ext.String.htmlDecode(colorName) }); - - this.object.set('axis-color-map', newValue); - }, - click: { - element: 'el', - fn: function(e,t) { - var me = t, - text = me.getAttribute('amda_clicktip'); - if (text) { - e.preventDefault(); - AmdaAction.getInfo({name : text}, function(res,e) { - if (res.success) myDesktopApp.infoMsg(res.result); - }); - } - } - }, - scope:this - }, - }); - - - var timeItems = [combo, - this.addColorsPicker('axis-color-minval', 'Min. Val. Color', amdaPlotObj.PlotObjectConfig.availableColorsNew, 'none'), - this.addColorsPicker('axis-color-maxval', 'Max. Val. Color', amdaPlotObj.PlotObjectConfig.availableColorsNew, 'none') + var timeItems = [ + this.addColorMapCombo('axis-color-map'), + this.addColorsPicker('axis-color-minval', 'Min. Val. Color', amdaPlotObj.PlotObjectConfig.availableColorsNew, 'none'), + this.addColorsPicker('axis-color-maxval', 'Max. Val. Color', amdaPlotObj.PlotObjectConfig.availableColorsNew, 'none') ]; return Ext.Array.merge(timeItems, this.callParent()); diff --git a/js/app/views/PlotComponents/PlotSpectroForm.js b/js/app/views/PlotComponents/PlotSpectroForm.js index 801e225..30cead7 100644 --- a/js/app/views/PlotComponents/PlotSpectroForm.js +++ b/js/app/views/PlotComponents/PlotSpectroForm.js @@ -21,6 +21,16 @@ Ext.define('amdaPlotComp.PlotSpectroForm', { this.loadRecord(this.object); }, + setParentObject: function (parentObject) { + this.callParent(arguments); + this.updateColorMap(); + }, + + updateColorMap: function() { + var colorAxisObj = this.parentObject.axes().getById('color'); + this.getForm().findField('spectro-color-map').setValue(colorAxisObj.get('axis-color-map')); + }, + getValuesRangeItems: function () { return [ this.addStandardFloat2('spectro-value-min', 'Min value', -Number.MAX_VALUE, Number.MAX_VALUE, true), @@ -267,6 +277,9 @@ Ext.define('amdaPlotComp.PlotSpectroForm', { }); return [ + this.addColorMapCombo('spectro-color-map', function(name, newValue, oldValue){ + ref.parentObject.axes().getById('color').set('axis-color-map', newValue); + }), this.addStandardCombo('spectro-resolution', 'Points per plot', amdaPlotObj.PlotObjectConfig.availableResolutions, function (name, value, oldValue) { ref.object.set('spectro-resolution', value); }), diff --git a/js/app/views/PlotComponents/PlotStandardForm.js b/js/app/views/PlotComponents/PlotStandardForm.js index 8fe5037..e388634 100644 --- a/js/app/views/PlotComponents/PlotStandardForm.js +++ b/js/app/views/PlotComponents/PlotStandardForm.js @@ -435,6 +435,69 @@ Ext.define('amdaPlotComp.PlotStandardForm', { }}); }, + addColorMapCombo: function (name, onChange) { + var data = []; + amdaPlotObj.PlotObjectConfig.availableColorMaps.forEach(function(color){ + data.push({key:color.key,name:color.value, iconUrl:'generic_data/colormaps/'+ color.svgFile}) + }); + + var combo = new Ext.form.ComboBox({ + name: name, + fieldLabel: 'Colour Map <img amda_clicktip="colourMaps" style="vertical-align:bottom" src="js/resources/images/16x16/info_mini.png"', + store: new Ext.data.Store({ + fields: ['key','name', 'iconUrl'], + data: data + }), + displayField: 'name', + valueField: 'key', + tpl: '<tpl for="."><div class="x-boundlist-item"><span data-qtip="{name}"> \ + <img src="{iconUrl}" class="svg-icon" style="height: 26px;"> \ + </span>\ + </div></tpl>', + editable: false, + queryMode: 'local', + listeners: { + change: function (combo, newValue, oldValue, eOpts) { + var iconUrl=""; + var colorName = ""; + data.forEach(function(colorData){ + if(colorData.key == newValue ){ + iconUrl= colorData.iconUrl; + colorName = colorData.name; + } + }); + combo.inputEl.setStyle('background-image', 'url(' + iconUrl + ')'); + combo.inputEl.setStyle('background-size', '100%'); + combo.inputEl.setStyle('background-repeat', 'no-repeat'); + combo.inputEl.setStyle('background-position', 'center'); + combo.inputEl.setStyle('font-size', '0'); + + combo.inputEl.set({ "data-qtip": Ext.String.htmlDecode(colorName) }); + + this.object.set(name, newValue); + if (onChange != null) + onChange(name, newValue, oldValue); + }, + click: { + element: 'el', + fn: function(e,t) { + var me = t, + text = me.getAttribute('amda_clicktip'); + if (text) { + e.preventDefault(); + AmdaAction.getInfo({name : text}, function(res,e) { + if (res.success) myDesktopApp.infoMsg(res.result); + }); + } + } + }, + scope:this + }, + }); + + return combo; + }, + init: function (config) { var me = this; -- libgit2 0.21.2