-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix for Scattergl animation bug #6452
Open
alexturcea
wants to merge
5
commits into
plotly:master
Choose a base branch
from
alexturcea:fix-issues-6251
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
369977f
Fix for https://github.com/plotly/plotly.js/issues/6251
alexturcea 544ba78
Perhaps this fix is more general?
alexturcea 53e4a73
Update plot.js
alexturcea 9743ef5
Made changes more evident
alexturcea 1129bc3
Merge https://github.com/plotly/plotly.js into fix-issues-6251
alexturcea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,6 @@ var exports = module.exports = function plot(gd, subplot, cdata) { | |
return; | ||
} | ||
|
||
var count = scene.count; | ||
var regl = fullLayout._glcanvas.data()[0].regl; | ||
|
||
// that is needed for fills | ||
|
@@ -74,28 +73,28 @@ var exports = module.exports = function plot(gd, subplot, cdata) { | |
scene.fill2d = createLine(regl); | ||
} | ||
if(scene.glText === true) { | ||
scene.glText = new Array(count); | ||
for(i = 0; i < count; i++) { | ||
scene.glText = new Array(cdata.length); | ||
for(i = 0; i < cdata.length; i++) { | ||
scene.glText[i] = new Text(regl); | ||
} | ||
} | ||
|
||
// update main marker options | ||
if(scene.glText) { | ||
if(count > scene.glText.length) { | ||
if(cdata.length > scene.glText.length) { | ||
// add gl text marker | ||
var textsToAdd = count - scene.glText.length; | ||
var textsToAdd = cdata.length - scene.glText.length; | ||
for(i = 0; i < textsToAdd; i++) { | ||
scene.glText.push(new Text(regl)); | ||
} | ||
} else if(count < scene.glText.length) { | ||
} else if(cdata.length < scene.glText.length) { | ||
// remove gl text marker | ||
var textsToRemove = scene.glText.length - count; | ||
var removedTexts = scene.glText.splice(count, textsToRemove); | ||
var textsToRemove = scene.glText.length - cdata.length; | ||
var removedTexts = scene.glText.splice(cdata.length, textsToRemove); | ||
removedTexts.forEach(function(text) { text.destroy(); }); | ||
} | ||
|
||
for(i = 0; i < count; i++) { | ||
for(i = 0; i < cdata.length; i++) { | ||
scene.glText[i].update(scene.textOptions[i]); | ||
} | ||
} | ||
|
@@ -128,7 +127,7 @@ var exports = module.exports = function plot(gd, subplot, cdata) { | |
} | ||
|
||
// fill requires linked traces, so we generate it's positions here | ||
scene.fillOrder = Lib.repeat(null, count); | ||
scene.fillOrder = Lib.repeat(null, cdata.length); | ||
if(scene.fill2d) { | ||
scene.fillOptions = scene.fillOptions.map(function(fillOptions, i) { | ||
var cdscatter = cdata[i]; | ||
|
@@ -255,7 +254,7 @@ var exports = module.exports = function plot(gd, subplot, cdata) { | |
var isSelectMode = selectMode(dragmode); | ||
var clickSelectEnabled = fullLayout.clickmode.indexOf('select') > -1; | ||
|
||
for(i = 0; i < count; i++) { | ||
for(i = 0; i < cdata.length; i++) { | ||
var cd0 = cdata[i][0]; | ||
var trace = cd0.trace; | ||
var stash = cd0.t; | ||
|
@@ -306,8 +305,8 @@ var exports = module.exports = function plot(gd, subplot, cdata) { | |
|
||
// use unselected styles on 'context' canvas | ||
if(scene.scatter2d) { | ||
var unselOpts = new Array(count); | ||
for(i = 0; i < count; i++) { | ||
var unselOpts = new Array(cdata.length); | ||
for(i = 0; i < cdata.length; i++) { | ||
unselOpts[i] = scene.selectBatch[i].length || scene.unselectBatch[i].length ? | ||
scene.markerUnselectedOptions[i] : | ||
{}; | ||
|
@@ -348,7 +347,7 @@ var exports = module.exports = function plot(gd, subplot, cdata) { | |
(yaxis._rl || yaxis.range)[1] | ||
] | ||
}; | ||
var vpRange = Lib.repeat(vpRange0, scene.count); | ||
var vpRange = Lib.repeat(vpRange0, cdata.length); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about this one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change required? |
||
|
||
// upload viewport/range data to GPU | ||
if(scene.fill2d) { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to just
var count = cdata.length
in that case - and remove all the other changes?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! @eiriklv Could you please
fetch upstream/master
on your fork and test it by opening a PR?