Commit da1cb3af32456334f59bdc896e86567355bb1f0c

Authored by Benjamin Renard
1 parent 0ceb8de8

Add panel highlight in interactive plot

js/app/views/PlotComponents/PlotResultImage.js
@@ -25,6 +25,8 @@ Ext.define('amdaPlotComp.PlotResultImage', { @@ -25,6 +25,8 @@ Ext.define('amdaPlotComp.PlotResultImage', {
25 secondVerticalMarker : null, 25 secondVerticalMarker : null,
26 firstHorizontalMarker : null, 26 firstHorizontalMarker : null,
27 secondHorizontalMarker : null, 27 secondHorizontalMarker : null,
  28 +
  29 + panelMarker : null,
28 30
29 showVerticalCursor : true, 31 showVerticalCursor : true,
30 showHorizontalCursor : true, 32 showHorizontalCursor : true,
@@ -62,6 +64,17 @@ Ext.define('amdaPlotComp.PlotResultImage', { @@ -62,6 +64,17 @@ Ext.define('amdaPlotComp.PlotResultImage', {
62 this.el.parent().appendChild(horizontalDiv); 64 this.el.parent().appendChild(horizontalDiv);
63 return horizontalDiv; 65 return horizontalDiv;
64 }, 66 },
  67 +
  68 + createNewPanelMarkerDiv : function() {
  69 + var panelDiv = new Ext.Element(document.createElement('div'));
  70 + panelDiv.setStyle('position', 'absolute');
  71 + panelDiv.setStyle('left', '1px');
  72 + panelDiv.setStyle('width', '1px');
  73 + panelDiv.setStyle('border', "1px none rgb(255, 0, 0)");
  74 + panelDiv.setStyle('pointer-events', 'none');
  75 + this.el.parent().appendChild(panelDiv);
  76 + return panelDiv;
  77 + },
65 78
66 resetCursor : function() { 79 resetCursor : function() {
67 if (this.horizontalCursor) 80 if (this.horizontalCursor)
@@ -86,6 +99,20 @@ Ext.define('amdaPlotComp.PlotResultImage', { @@ -86,6 +99,20 @@ Ext.define('amdaPlotComp.PlotResultImage', {
86 this.verticalCursor.setStyle('borderLeftStyle', 'solid'); 99 this.verticalCursor.setStyle('borderLeftStyle', 'solid');
87 } 100 }
88 }, 101 },
  102 +
  103 + resetPanel : function() {
  104 + if (this.panelMarker)
  105 + this.panelMarker.setStyle('borderStyle', 'none');
  106 + },
  107 +
  108 + updatePanel : function(containerX, containerY, containerWidth, containerHeight) {
  109 + this.panelMarker.setStyle('left',containerX+'px');
  110 + this.panelMarker.setStyle('top',containerY+'px');
  111 + this.panelMarker.setStyle('width',containerWidth+'px');
  112 + this.panelMarker.setStyle('height',containerHeight+'px');
  113 + this.panelMarker.setStyle('borderStyle', 'dashed');
  114 + this.panelMarker.setStyle('borderWidth', '3px');
  115 + },
89 116
90 resetZoom : function() { 117 resetZoom : function() {
91 //This function is override during a startZoom call 118 //This function is override during a startZoom call
@@ -195,6 +222,8 @@ Ext.define('amdaPlotComp.PlotResultImage', { @@ -195,6 +222,8 @@ Ext.define('amdaPlotComp.PlotResultImage', {
195 me.firstHorizontalMarker = me.createNewHorizontalDiv(); 222 me.firstHorizontalMarker = me.createNewHorizontalDiv();
196 me.secondHorizontalMarker = me.createNewHorizontalDiv(); 223 me.secondHorizontalMarker = me.createNewHorizontalDiv();
197 224
  225 + me.panelMarker = me.createNewPanelMarkerDiv();
  226 +
198 me.resetCursor(); 227 me.resetCursor();
199 }, 228 },
200 el: { 229 el: {
js/app/views/PlotComponents/PlotZoomPlug.js
@@ -147,8 +147,12 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { @@ -147,8 +147,12 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
147 listeners: { 147 listeners: {
148 scope: this, 148 scope: this,
149 beforeclose: function () { 149 beforeclose: function () {
  150 + this.hostCmp.panelImage.hidePanelMarker();
150 this.hostCmp.panelImage.stopZoom(); 151 this.hostCmp.panelImage.stopZoom();
151 Ext.PluginManager.unregister(this); 152 Ext.PluginManager.unregister(this);
  153 + },
  154 + show: function(win, eOpts) {
  155 + this.hostCmp.panelImage.showPanelMarker(panelId);
152 } 156 }
153 }, 157 },
154 getConstrainVector: function (constrainTo) { 158 getConstrainVector: function (constrainTo) {
js/app/views/PlotTabResultUI.js
@@ -220,10 +220,10 @@ Ext.define('amdaUI.PlotTabResultUI', { @@ -220,10 +220,10 @@ Ext.define('amdaUI.PlotTabResultUI', {
220 me.contextualMenu.add('-'); 220 me.contextualMenu.add('-');
221 me.contextualMenu.add(insertIntervalItem); 221 me.contextualMenu.add(insertIntervalItem);
222 } 222 }
223 - /*if (plotFunctionItem != null) { // #9016 & #6018 - Hide - Not fully tested 223 + if (plotFunctionItem != null) { // #9016 & #6018 - Hide - Not fully tested
224 me.contextualMenu.insert(0, '-'); 224 me.contextualMenu.insert(0, '-');
225 me.contextualMenu.insert(0, plotFunctionItem); 225 me.contextualMenu.insert(0, plotFunctionItem);
226 - }*/ 226 + }
227 }, 227 },
228 228
229 getAxisValue: function (axis, pixelMin, pixelMax, pixelVal) { 229 getAxisValue: function (axis, pixelMin, pixelMax, pixelVal) {
@@ -238,6 +238,19 @@ Ext.define('amdaUI.PlotTabResultUI', { @@ -238,6 +238,19 @@ Ext.define('amdaUI.PlotTabResultUI', {
238 src: this.getImageUrl(resultFolder, plotFile), 238 src: this.getImageUrl(resultFolder, plotFile),
239 width: size.width, 239 width: size.width,
240 height: size.height, 240 height: size.height,
  241 + showPanelMarker: function (panelId) {
  242 + var panel = amdaPlotComp.PlotContextManager.getPanelById(me.crtContext, panelId);
  243 + if (panel) {
  244 + me.panelImage.updatePanel(
  245 + me.toPixelOnResultImage(panel.x),
  246 + me.toPixelOnResultImage(panel.y),
  247 + me.toPixelOnResultImage(panel.width),
  248 + me.toPixelOnResultImage(panel.height));
  249 + }
  250 + },
  251 + hidePanelMarker: function () {
  252 + me.panelImage.resetPanel();
  253 + },
241 onMouseMove: function (x, y) { 254 onMouseMove: function (x, y) {
242 if (!me.crtContext) 255 if (!me.crtContext)
243 return; 256 return;