From 685c53446a08c8f658717f736afff6f322b52ae1 Mon Sep 17 00:00:00 2001 From: Grant Faiks Date: Wed, 24 Jun 2020 13:22:08 -0400 Subject: [PATCH] fix: rescale based on changing cx mode --- js/sigplot.js | 7 ++++--- js/sigplot.layer1dSDS.js | 43 ++++++++++++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/js/sigplot.js b/js/sigplot.js index 8b64fb9..632d35d 100644 --- a/js/sigplot.js +++ b/js/sigplot.js @@ -2556,7 +2556,7 @@ hcb._uuid = lyr_uuid; common.update(hcb, overrides); if (layertype === "SDS") { - if (hcb.file_type===1000) { + if (hcb.file_type === 1000) { layerOptions.layerType = "1DSDS"; } else { layerOptions.layerType = "2DSDS"; @@ -2564,7 +2564,7 @@ } else { layerOptions.layerType = layertype; } - + i = plot.overlay_bluefile(hcb, layerOptions); if (onload) { onload(hcb, i); @@ -2581,7 +2581,7 @@ if (href.endsWith(".mat")) { reader = new matfile.MatFileReader(); oReq = reader.read_http(href, handleHeader); - } else if (layerOptions && (layerOptions.layerType === "2DSDS" || layerOptions.layerType === "1DSDS" || layerOptions.layerType === "SDS")) { + } else if (layerOptions && (layerOptions.layerType === "2DSDS" || layerOptions.layerType === "1DSDS" || layerOptions.layerType === "SDS")) { // TODO it would be nice to not check layerType here but either // peek at the URL contents OR use something in the URL oReq = new XMLHttpRequest(); @@ -8676,6 +8676,7 @@ ymax }) { var Gx = plot._Gx; + var Mx = plot._Mx; if (xmin !== undefined) { if (Gx.panxmin === undefined) { diff --git a/js/sigplot.layer1dSDS.js b/js/sigplot.layer1dSDS.js index f1cd846..d3e7963 100644 --- a/js/sigplot.layer1dSDS.js +++ b/js/sigplot.layer1dSDS.js @@ -125,8 +125,18 @@ }, change_settings: function(settings) { - var localsettings = settings; - + var Gx = this.plot._Gx; + if (settings.cmode !== undefined) { // If setting a new cmode then reset y values. + + if (((Gx.autoz & 1) !== 0)) { + this.ymin = 0; + this.localpanymin = 0; + } + if (((Gx.autoz & 2) !== 0)) { + this.ymax = -1; + this.localpanymax = -1; + } + } }, reload: function(data, hdrmod) { @@ -338,7 +348,12 @@ }, get_pan_bounds: function(view) { - + var cacheData = this.get_data_from_cache(); + if (cacheData.plotData) { + this.ymin = cacheData.plotData.zmin; + this.ymax = cacheData.plotData.zmax; + this.set_pan_values(); + } var xmin,xmax,ymin,ymax; if (this.localpanxmin