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

set defaultMaxPitch to 85 #56

Closed
wants to merge 2 commits into from

Conversation

cigone-openindoor
Copy link

@cigone-openindoor cigone-openindoor commented Jan 12, 2021

Just changed the default maxPitch.

Fix #47

@github-actions
Copy link
Contributor

github-actions bot commented Jan 12, 2021

Bundle size report:

Size Change: +2 B
Total Size Before: 201 kB
Total Size After: 201 kB

Output file Before After Change
mapbox-gl.js 196 kB 196 kB +2 B
mapbox-gl.css 4.62 kB 4.62 kB 0 B
ℹ️ View Details
Source file Before After Change
src/ui/map.js 6.51 kB 6.51 kB +3 B

@cigone-openindoor
Copy link
Author

I don't know why macos test failed but I guess it has no relation with my changes.

@curran
Copy link
Contributor

curran commented Jan 19, 2021

CI is failing. Please fix CI for a proper review. Thanks!

@clement-igonet
Copy link

Thank you, i've seen the red cross also.
It's a mac specific issue.
I've no way to check further.
Any advice to solve this blocker ?

@msbarry
Copy link
Contributor

msbarry commented Jan 20, 2021

The mac and windows CI jobs seem to be a bit flaky. I just re-ran and it's all green now.

@clement-igonet
Copy link

clement-igonet commented Jan 21, 2021

Well, improvement should be to accept maxPitch until 85, but limit it to 60 by default.
I'll check it...

@klokan
Copy link
Member

klokan commented Jan 26, 2021

I think default should remain on 60.

@ghost
Copy link

ghost commented Jan 28, 2021

This should remain a very niche feature until properly implemented, unlike in mapbox 2.0 where it's a first-class citizen (and where users are encouraged to use larger pitch ranges).

Therefore, we probably want to warn (i.e. document somewhere) that higher-than 60 degree pitch can lead to excessive amount of tiles and thereby tile cache trashing.
We should also document that it can also break navigation (try navigating using mouse-drag towards horizon).
We should document that this feature should not be used for standard maps (it's only really "functional" for specific situations).

@clement-igonet
Copy link

clement-igonet commented Jan 28, 2021

I’ve double checked:
maxPitch = 60 by default,
but can rise 85 if explicitly defined like that.

@Joxit
Copy link
Contributor

Joxit commented Feb 17, 2021

👍 @clement-igonet

You should change this piece of code instead of the defaultMaxPitch.

if (options.maxPitch != null && options.maxPitch > defaultMaxPitch) {
throw new Error(`maxPitch must be less than or equal to ${defaultMaxPitch}`);
}

In this case the default maxPitch value will remain 60, and you add a new variable like maxPitchThreshold = 85 and in this piece of code will look like

 if (options.maxPitch != null && options.maxPitch > maxPitchThreshold) { 
     throw new Error(`maxPitch must be less than or equal to ${maxPitchThreshold}`); 
 } 

@clement-igonet
Copy link

clement-igonet commented Feb 18, 2021

You're right.
However, it's just a matter of variable name, coming from mapbox original code.
I do not aim to go further than fixing the original issue.
You're welcome to apply your improvements in your own M.R.

@rbrundritt
Copy link
Contributor

To better handle larger pitch values, Mapbox also modified how tiles are loaded in the top half of the screen (load zoomed out tiles), for better performance. Here is the PR for that: mapbox/mapbox-gl-js#8975

@cigone-openindoor
Copy link
Author

I suggested my changes long time ago.
If nobody else approve (3/3), merge could block if someone else change same piece of code.
So what ?
Please, approve or kill my M.R.

@HarelM
Copy link
Collaborator

HarelM commented Jun 27, 2021

@cigone-openindoor first and foremost thanks for taking the time to do it and open this discussion!
However, I'm a little bit confused by this thread.
From the initial comment and the code my understanding is that the default for anyone not specifying maxPitch will (after this is merged) be 85.
If this is the case, I agree with @klokan and @Joxit that this is not the required behavior.
In my opinion, I think that if someone wants to explicitly change the maxPitch to be, say 85, it should be allowed using the map options parameter - i.e. this means that someone that is writing the code understands that this can cause performance issues, and also this can be documented as part of the definition of maxPitch in the map options parameters documentation.
I think the default should be kept as it is today at 60.

Please let me know if I misunderstood the changes and definition of this PR.

@cigone-openindoor
Copy link
Author

@cigone-openindoor first and foremost thanks for taking the time to do it and open this discussion!
However, I'm a little bit confused by this thread.
From the initial comment and the code my understanding is that the default for anyone not specifying maxPitch will (after this is merged) be 85.
If this is the case, I agree with @klokan and @Joxit that this is not the required behavior.
In my opinion, I think that if someone wants to explicitly change the maxPitch to be, say 85, it should be allowed using the map options parameter - i.e. this means that someone that is writing the code understands that this can cause performance issues, and also this can be documented as part of the definition of maxPitch in the map options parameters documentation.
I think the default should be kept as it is today at 60.

Please let me know if I misunderstood the changes and definition of this PR.

There is a misunderstanding I'm victim of, from the very beginning :
The default max value remains 60, not 85.
To define 85 as a max, it has to be explicitly define by the user.
I know that variable names are confusing. It comes from the original mapbox code, not mine.

@HarelM
Copy link
Collaborator

HarelM commented Jun 27, 2021

But in the test you fixed, the map creation is done without defining maxPitch but when asking the map for maxpirch it returns 85...?
I'm probably missing out something here...
I would advise to change a bit more in terms of variavles and function names to avoid this confusion...
If the mapbox code is confusing, let's change it... :-)

@cigone-openindoor
Copy link
Author

cigone-openindoor commented Jun 28, 2021

"defaultMaxPitch" is the maximum maxpitch the user can define, a kind of "maxmaxpitch". I just set it from 60 to 85.
maxpitch is still initialized at 60.

@HarelM
Copy link
Collaborator

HarelM commented Jun 28, 2021

mapDefaultMaxPitch (60)
userDedinedMaxPitch (85)
I think are good names for these variables...

@Joxit
Copy link
Contributor

Joxit commented Jun 28, 2021

Hi there,

So, I tried this PR, and as I said earlier, you must add a new variable maxPitchThreshold, this is not a naming issue but a change in behavior.
After this PR, the default max value will be 85, and not 60.

image

@HarelM
Copy link
Collaborator

HarelM commented Jul 5, 2021

@cigone-openindoor let me know if you plan to fix the code review comment and follow the required behavior.

@rbrundritt
Copy link
Contributor

rbrundritt commented Sep 20, 2021

I've been experimenting with this and think I found a key bug. When the pitch is greater than 70 degrees, queryRenderedFeatures stops work with some layers appear to stop working. In my test app I have the following:

Not working

  • Circle layer (Vector tiles source)

Working fine

  • Polygon extrusion layer (Vector tiles source)
  • Polygon layer (Vector tiles source)
  • Symbol layer (GeoJSON source)

I think it might be something to do with the adjustment in the radius in this loop

for (const ring of geometry) {

@kibala145 kibala145 mentioned this pull request Oct 26, 2021
@HarelM
Copy link
Collaborator

HarelM commented Oct 26, 2021

Closed in favor of #574

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

Successfully merging this pull request may close these issues.

max pitch
10 participants