Skip to content

Init Float32Array with explicit length of 0 #569

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 1 commit into from
May 26, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/traces/contourgl/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Contour(scene, uid) {
this.bounds = [0, 0, 0, 0];

this.contourOptions = {
z: new Float32Array(),
z: new Float32Array(0),
Copy link
Contributor

@mdtusz mdtusz May 26, 2016

Choose a reason for hiding this comment

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

Interesting that this is required (I assume the missing 0 caused issue somewhere?)

Edit: Well I suppose I could have read the rest of the changes 😛

x: [],
y: [],
shape: [0, 0],
Expand All @@ -44,7 +44,7 @@ function Contour(scene, uid) {
this.contour._trace = this;

this.heatmapOptions = {
z: new Float32Array(),
z: new Float32Array(0),
x: [],
y: [],
shape: [0, 0],
Expand Down
24 changes: 12 additions & 12 deletions src/traces/scattergl/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function LineWithMarkers(scene, uid) {

this.hasLines = false;
this.lineOptions = {
positions: new Float32Array(),
positions: new Float32Array(0),
color: [0, 0, 0, 1],
width: 1,
fill: [false, false, false, false],
Expand All @@ -64,8 +64,8 @@ function LineWithMarkers(scene, uid) {

this.hasErrorX = false;
this.errorXOptions = {
positions: new Float32Array(),
errors: new Float32Array(),
positions: new Float32Array(0),
errors: new Float32Array(0),
lineWidth: 1,
capSize: 0,
color: [0, 0, 0, 1]
Expand All @@ -75,8 +75,8 @@ function LineWithMarkers(scene, uid) {

this.hasErrorY = false;
this.errorYOptions = {
positions: new Float32Array(),
errors: new Float32Array(),
positions: new Float32Array(0),
errors: new Float32Array(0),
lineWidth: 1,
capSize: 0,
color: [0, 0, 0, 1]
Expand All @@ -86,7 +86,7 @@ function LineWithMarkers(scene, uid) {

this.hasMarkers = false;
this.scatterOptions = {
positions: new Float32Array(),
positions: new Float32Array(0),
sizes: [],
colors: [],
glyphs: [],
Expand Down Expand Up @@ -330,13 +330,13 @@ proto.updateFast = function(options) {
this.scatter.update(this.scatterOptions);
}
else {
this.scatterOptions.positions = new Float32Array();
this.scatterOptions.positions = new Float32Array(0);
this.scatterOptions.glyphs = [];
this.scatter.update(this.scatterOptions);
}

// turn off fancy scatter plot
this.scatterOptions.positions = new Float32Array();
this.scatterOptions.positions = new Float32Array(0);
this.scatterOptions.glyphs = [];
this.fancyScatter.update(this.scatterOptions);

Expand Down Expand Up @@ -455,13 +455,13 @@ proto.updateFancy = function(options) {
this.fancyScatter.update(this.scatterOptions);
}
else {
this.scatterOptions.positions = new Float32Array();
this.scatterOptions.positions = new Float32Array(0);
this.scatterOptions.glyphs = [];
this.fancyScatter.update(this.scatterOptions);
}

// turn off fast scatter plot
this.scatterOptions.positions = new Float32Array();
this.scatterOptions.positions = new Float32Array(0);
this.scatterOptions.glyphs = [];
this.scatter.update(this.scatterOptions);

Expand Down Expand Up @@ -514,7 +514,7 @@ proto.updateLines = function(options, positions) {
this.lineOptions.fillColor = [fillColor, fillColor, fillColor, fillColor];
}
else {
this.lineOptions.positions = new Float32Array();
this.lineOptions.positions = new Float32Array(0);
}

this.line.update(this.lineOptions);
Expand All @@ -537,7 +537,7 @@ proto.updateError = function(axLetter, options, positions, errors) {
errorObjOptions.color = convertColor(errorOptions.color, 1, 1);
}
else {
errorObjOptions.positions = new Float32Array();
errorObjOptions.positions = new Float32Array(0);
}

errorObj.update(errorObjOptions);
Expand Down