10000 Issue 0179 by archmoj · Pull Request #3299 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Issue 0179 #3299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
better fix for issue 2208 and prepration for issue-0179 and surfaces …
…with log axis
  • Loading branch information
archmoj committed Nov 27, 2018
commit ac319ef533eb1d829048997fa8a363bfc8f3ed88
5 changes: 5 additions & 0 deletions src/plots/gl3d/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ function computeTraceBounds(scene, trace, bounds) {
}
}
}

if(trace.type === 'surface') {
bounds[0][d] += trace._worldOffset[d];
bounds[1][d] += trace._worldOffset[d];
}
}
}

Expand Down
19 changes: 5 additions & 14 deletions src/traces/surface/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,13 @@ proto.getZat = function(a, b, calendar, axis) {
);

return (calendar === undefined) ? v : axis.d2l(v, 0, calendar);
// return (calendar === undefined) ? null2undefined(v) : axis.d2l(v, 0, calendar);
};
/*
function null2undefined(a) {
// Note: null * 1.0 = 0.0!
// Therefore we convert nul to undefined.
// where undefined * 1.0 = NaN
return (a === null) ? undefined : a;
}
*/

proto.handlePick = function(selection) {
if(selection.object === this.surface) {

var j = Math.min(Math.floor(selection.data.index[0] / this.dataScaleX - 1), this.data.z[0].length - 1);
var k = Math.min(Math.floor(selection.data.index[1] / this.dataScaleY - 1), this.data._ylength - 1);
var j = Math.max(Math.min(Math.floor(selection.data.index[0] / this.dataScaleX - 0.5), this.data._xlength - 1), 0);
var k = Math.max(Math.min(Math.floor(selection.data.index[1] / this.dataScaleY - 0.5), this.data._ylength - 1), 0);

selection.index = [j, k];

Expand Down Expand Up @@ -352,7 +344,7 @@ proto.update = function(data) {
alpha = data.opacity,
colormap = parseColorScale(data.colorscale, alpha),
scaleFactor = scene.dataScale,
xlen = data.z.length,
xlen = data._xlength,
ylen = data._ylength,
contourLevels = scene.contourLevels;

Expand Down Expand Up @@ -423,7 +415,7 @@ proto.update = function(data) {
}

for(i = 0; i < 3; i++) {
this.midValues[i] = 0.5 * (this.minValues[i] + this.maxValues[i]);
data._worldOffset = this.midValues[i] = 0.0; // 0.5 * (this.minValues[i] + this.maxValues[i]);
}

for(i = 0; i < 3; i++) {
Expand Down Expand Up @@ -550,7 +542,6 @@ proto.update = function(data) {
}

params.coords = coords;

surface.update(params);

surface.visible = data.visible;
Expand Down
2 changes: 2 additions & 0 deletions src/traces/surface/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
traceOut._xlength = (Array.isArray(x) && Lib.isArrayOrTypedArray(x[0])) ? z.length : z[0].length;
traceOut._ylength = z.length;

traceOut._worldOffset = [0, 0, 0];

var handleCalendarDefaults = Registry.getComponentMethod('calendars', 'handleTraceDefaults');
handleCalendarDefaults(traceIn, traceOut, ['x', 'y', 'z'], layout);

Expand Down
0