Skip to content

improve performance in few places at plot_api and modebar #5047

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 2 commits into from
Aug 11, 2020
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
7 changes: 5 additions & 2 deletions src/components/modebar/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ modeBarButtons.resetCameraLastSave3d = {
function handleCamera3d(gd, ev) {
var button = ev.currentTarget;
var attr = button.getAttribute('data-attr');
var resetLastSave = attr === 'resetLastSave';
var resetDefault = attr === 'resetDefault';

var fullLayout = gd._fullLayout;
var sceneIds = fullLayout._subplots.gl3d || [];
var aobj = {};
Expand All @@ -402,12 +405,12 @@ function handleCamera3d(gd, ev) {
var scene = fullLayout[sceneId]._scene;
var didUpdate;

if(attr === 'resetLastSave') {
if(resetLastSave) {
aobj[camera + '.up'] = scene.viewInitial.up;
aobj[camera + '.eye'] = scene.viewInitial.eye;
aobj[camera + '.center'] = scene.viewInitial.center;
didUpdate = true;
} else if(attr === 'resetDefault') {
} else if(resetDefault) {
aobj[camera + '.up'] = null;
aobj[camera + '.eye'] = null;
aobj[camera + '.center'] = null;
Expand Down
9 changes: 5 additions & 4 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1739,13 +1739,14 @@ function _restyle(gd, aobj, traces) {
// swap hovermode if set to "compare x/y data"
if(ai === 'orientationaxes') {
var hovermode = nestedProperty(gd.layout, 'hovermode');
if(hovermode.get() === 'x') {
var h = hovermode.get();
if(h === 'x') {
hovermode.set('y');
} else if(hovermode.get() === 'y') {
} else if(h === 'y') {
hovermode.set('x');
} else if(hovermode.get() === 'x unified') {
} else if(h === 'x unified') {
hovermode.set('y unified');
} else if(hovermode.get() === 'y unified') {
} else if(h === 'y unified') {
hovermode.set('x unified');
}
}
Expand Down