Skip to content

Commit

Permalink
fix: rescale based on changing cx mode
Browse files Browse the repository at this point in the history
  • Loading branch information
gfaiks committed Jun 24, 2020
1 parent d665dbc commit 685c534
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
7 changes: 4 additions & 3 deletions js/sigplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2556,15 +2556,15 @@
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";
}
} else {
layerOptions.layerType = layertype;
}

i = plot.overlay_bluefile(hcb, layerOptions);
if (onload) {
onload(hcb, i);
Expand All @@ -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();
Expand Down Expand Up @@ -8676,6 +8676,7 @@
ymax
}) {
var Gx = plot._Gx;
var Mx = plot._Mx;

if (xmin !== undefined) {
if (Gx.panxmin === undefined) {
Expand Down
43 changes: 32 additions & 11 deletions js/sigplot.layer1dSDS.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<this.localpanxmax) {
xmin = this.localpanxmin;
Expand All @@ -357,10 +372,8 @@
};
},

draw: function() {
get_data_from_cache() {
var Mx = this.plot._Mx;
var Gx = this.plot._Gx;


var x1 = Math.round((Mx.stk[Mx.level].xmin - this.xmin)/this.hcb.xdelta) ;
var x2 = Math.round((Mx.stk[Mx.level].xmax - this.xmin)/this.hcb.xdelta) ;
Expand All @@ -386,12 +399,20 @@
}
}
}
return {
url: url,
plotData: plotData
};
},

draw: function() {
var cacheData = this.get_data_from_cache();

if (plotData) {
this.server_data = new Int16Array(plotData);
if (cacheData.plotData) {
this.server_data = new Int16Array(cacheData.plotData);

this.ymin = plotData.zmin;
this.ymax = plotData.zmax;
this.ymin = cacheData.plotData.zmin;
this.ymax = cacheData.plotData.zmax;
this.set_pan_values();
this.process_plot_data();
return {
Expand All @@ -402,7 +423,7 @@
};

} else { // We don't already have this data so we need to ask for it.
this.send_request_to_server(url);
this.send_request_to_server(cacheData.url);
}


Expand Down

0 comments on commit 685c534

Please sign in to comment.