Skip to content
Merged
Changes from 3 commits
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
9 changes: 1 addition & 8 deletions src/traces/mesh3d/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,13 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
}

var coords = readComponents(['x', 'y', 'z']);
var indices = readComponents(['i', 'j', 'k']);
readComponents(['i', 'j', 'k']);

if(!coords) {
traceOut.visible = false;
return;
}

if(indices) {
// otherwise, convert all face indices to ints
indices.forEach(function(index) {
for(var i = 0; i < index.length; ++i) index[i] |= 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. So you didn't move this to mesh3d/convert.js? Just 🔪 ing it didn't break any tests?

Can you try plotting a mesh3d trace with non-integer indices and see what happens?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etpinard Thanks for the review.
That's true! One could get bad errors in case of having non-integer ids.
So, in the revised code I added map functions to round the float values to integers.
However; there is now extra logic to check and handle for such cases. A series of jasmine tests are also added to define the expected behaviour in various scenarios.

});
}

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

Expand Down