-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix #2452 - removing and adding scatter(gl) as not the first module #2455
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,35 +216,19 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) | |
var oldModules = oldFullLayout._modules || [], | ||
newModules = newFullLayout._modules || []; | ||
|
||
var hadScatter, hasScatter, hadGl, hasGl, i, oldPlots, ids, subplotInfo; | ||
var hadScatter, hasScatter, hadGl, hasGl, i, oldPlots, ids, subplotInfo, moduleName; | ||
|
||
|
||
for(i = 0; i < oldModules.length; i++) { | ||
if(oldModules[i].name === 'scatter') { | ||
hadScatter = true; | ||
} | ||
break; | ||
} | ||
|
||
for(i = 0; i < newModules.length; i++) { | ||
if(newModules[i].name === 'scatter') { | ||
hasScatter = true; | ||
break; | ||
} | ||
} | ||
|
||
for(i = 0; i < oldModules.length; i++) { | ||
if(oldModules[i].name === 'scattergl') { | ||
hadGl = true; | ||
} | ||
break; | ||
moduleName = oldModules[i].name; | ||
if(moduleName === 'scatter') hadScatter = true; | ||
else if(moduleName === 'scattergl') hadGl = true; | ||
} | ||
|
||
for(i = 0; i < newModules.length; i++) { | ||
if(newModules[i].name === 'scattergl') { | ||
hasGl = true; | ||
break; | ||
} | ||
moduleName = newModules[i].name; | ||
if(moduleName === 'scatter') hasScatter = true; | ||
else if(moduleName === 'scattergl') hasGl = true; | ||
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. Great. We should starting thinking about generalizing this pattern. In short, this loop and its |
||
} | ||
|
||
if(hadScatter && !hasScatter) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -610,7 +610,9 @@ function sceneUpdate(gd, subplot) { | |
scene.selectBatch = null; | ||
scene.unselectBatch = null; | ||
|
||
delete subplot._scene; | ||
// we can't just delete _scene, because `destroy` is called in the | ||
// middle of supplyDefaults, before relinkPrivateKeys which will put it back. | ||
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.
If you ever run into a situation like this "but I deleted that, how come it's still here???" try setting it to 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. So after fixing the 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. Nice. I vaguely remember reading that |
||
subplot._scene = null; | ||
}; | ||
} | ||
|
||
|
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.
The main problem was this
break
being outside theif
. But then since we had the same loop twice and it's unlikely in general for both scatter and scattergl to be present, I combined them into one and dropped thebreak
altogether.