Skip to content
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

geo.visible false should override template.layout.geo.show* #4483

Merged
merged 7 commits into from
Jan 13, 2020

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Jan 10, 2020

Fixes: #4482 | before vs after

@plotly/plotly_js
cc: @nicolaskruchten @alexcjohnson

@archmoj archmoj added bug something broken status: reviewable labels Jan 10, 2020
src/plots/plots.js Outdated Show resolved Hide resolved
Plotly.plot(gd, data, layout)
.then(function() {
keys.forEach(function(k) {
expect(gd._fullLayout.template.layout.geo[k]).toBe(false, k);
Copy link
Collaborator

Choose a reason for hiding this comment

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

At the end of the day we don't care what's in _fullLayout.template - only the values of _fullLayout.geo*[k]. Would you mind modifying the test to look at these attributes, under both of the cases we discussed: visible: false in the main layout as well as visible: false in the template?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Fixed by 7e62ce4.

@nicolaskruchten
Copy link
Contributor

You’re doing the axis grid show attrs too right?

@archmoj
Copy link
Contributor Author

archmoj commented Jan 10, 2020

You’re doing the axis grid show attrs too right?

Oh no! I misread your reply here: #4482 (comment)

Thanks for pointing out!
So I need to add one more commit to this PR.

@archmoj
Copy link
Contributor Author

archmoj commented Jan 10, 2020

You’re doing the axis grid show attrs too right?

Now done in 1b905a1.

@@ -46,6 +46,28 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
var isClipped = geoLayoutOut._isClipped = !!constants.lonaxisSpan[projType];

var visible = coerce('visible');
if(visible === false) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is still incorrect when the visible=false came from the template (which we still need a test for - showing that all the show* end up true in that case). I guess the condition here should be if(geoLayoutIn.visible === false)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 639913e.

@@ -46,6 +46,29 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce, opts) {
var isClipped = geoLayoutOut._isClipped = !!constants.lonaxisSpan[projType];

var visible = coerce('visible');
if(geoLayoutIn.visible === false) {
visible = geoLayoutOut.visible = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we setting geoLayoutOut.visible = true here? Looks to me as though it doesn't matter for the end result, is that right? RCE would want the false to remain intact.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad.

layoutIn = {
template: {
layout: {
geo: {
Copy link
Collaborator

@alexcjohnson alexcjohnson Jan 11, 2020

Choose a reason for hiding this comment

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

sorry to be a pain, but I still don't see a test case that sets template.layout.geo.visible=false, does NOT set layout.geo.visible, and verifies that template.layout.geo.show* settings are still honored in fullLayout.geo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in 9448c8f.

when template.layout.geo.visible is set to false,
and does NOT set layout.geo.visible template
@nicolaskruchten
Copy link
Contributor

Reminder: we need this merged and released by end of day today if at all possible :)

Copy link
Contributor Author

@archmoj archmoj left a comment

Choose a reason for hiding this comment

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

The only new test that locks down the reported issue is added by 75d3e7d.

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

💃 thanks for bearing with me on this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

geo.visible vs template...showland
3 participants