mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

Pattern scale reset

Open natslaughter opened this issue 6 years ago • 8 comments

Current Issue In order for fill patterns to scale with tile sizes between zoom level integers, patterns are scaled up to 200%. If a map designer wants to use a fill pattern, they must be okay with a large range of pattern scaling for their map (a). If the map comes to rest in-between integer zoom levels, the patterns can be way off the intended map design (b).

Proposed Solution Reset the pattern scale to 100% when the map is at rest. “Rest” could be defined by 200ms of no zooming, but this should be tested. If a user is zooming in and out with a high frequency of stops, a constant resetting of pattern scale could be visually distracting. Currently, place-labels and other symbol layers are being re-rendered when the map is ‘at rest,’ so perhaps resetting the pattern scale would go unnoticed. I could see this enhancement being beneficial for line patterns as well.

a: scaling range of fill-patterns for one zoom level proposal1-1

b: visual difference between scale polars proposal1-2

cc @ansis @kkaefer @eschow @nickidlugash

natslaughter avatar Mar 07 '18 17:03 natslaughter

Other suboptimal effects of the current implementation:

  • Any scaling over 100% results in reduced resolution, which can be quite apparent at 199% scale on high-resolution screens. Switching over to vector icons should eventually fix this issue.
  • While scaling up/down across an integer zoom level is continuous, the reset between zoom levels is abrupt between 199% and 100%, though there is a hard-coded cross-fade value (300ms?) to ease the transition.

Hopefully the proposed solution will ease these two issues a bit too, since more resets should mean fewer instances of scaling close to 199%.

Reset the pattern scale to 100% when the map is at rest.

To clarify, would we want to do this in addition or instead of reseting at integer zoom levels? My instinct is that it should be in addition, since there may be situations (like during animations) where a map will be zooming across multiple zoom levels with no rest.

I could see this enhancement being beneficial for line patterns as well.

And line dasharrays!

nickidlugash avatar Mar 08 '18 17:03 nickidlugash

@ansis Any thoughts on how big of a lift it would be to test out this implementation?

nickidlugash avatar Apr 23 '18 18:04 nickidlugash

+1 on all points. The scaling of a pattern that's been designed to specific dimensions is pretty undesirable. To bounce off the proposed solution, could this be introduced as a new property with two enums?

{  
  fill-pattern-scale: `{auto|fixed}` // Defaults to 'auto'?
}

Edit: Removed Current behavior from the code comment. It wasn't my intention to say that 🙈

tristen avatar Sep 16 '19 18:09 tristen

fill-pattern-scale: {auto|fixed} // Defaults to 'auto'? (current behavior)

To me auto would imply that it automatically rescales - which is not the current behavior, and fixed suggests that it stays at a fixed scale.

@tristen Would this work better as a binary value? When true, scale the pattern between integer zoom levels, and when false scale the pattern during zoom operations and reset at rest.

asheemmamoowala avatar Sep 17 '19 21:09 asheemmamoowala

@tristen Would this work better as a binary value? When true, scale the pattern between integer zoom levels, and when false scale the pattern during zoom operations and reset at rest.

It could, I guess I was thinking if it was an enum, that it would give way to other scaling options in the future.

tristen avatar Sep 17 '19 21:09 tristen

@tristen what kinds of use cases do you have in mind where you might want the current behavior? I wasn't thinking of exposing this as an option 🤔

cc @mapbox/map-design-team

chloekraw avatar Oct 07 '19 23:10 chloekraw

@tristen what kinds of use cases do you have in mind where you might want the current behavior? I wasn't thinking of exposing this as an option 🤔

Oh! to be clear, we would do away with the current behavior. The options would be this:

  • auto (default behavior) would scale the pattern but reset to 100% resolution when the map is no longer scrolling.
  • fixed would not scale but persist a 100% resolution.

tristen avatar Oct 08 '19 16:10 tristen

Any updates on this? Would be glad if the proposed options above get implemented.

mdaffan01 avatar Oct 26 '22 12:10 mdaffan01