Skip to content

Support retina mode#585

Merged
johnpryan merged 6 commits intofleaflet:masterfrom
maRci002:support_retina_mode
Jul 8, 2020
Merged

Support retina mode#585
johnpryan merged 6 commits intofleaflet:masterfrom
maRci002:support_retina_mode

Conversation

@maRci002
Copy link
Copy Markdown
Contributor

@maRci002 maRci002 commented Apr 13, 2020

Hello, I made some changes to support simulating retina mode (note: If geoserver supports retina @2 tiles then it it advised to use them instead of simulating).

It won't detect if device supports retina because I don't want force user to use Material app because of MediaQuery.of(context).

However it is documented how to use it:

  /// If `true`, it will request four tiles of half the specified size and a
  /// bigger zoom level in place of one to utilize the high resolution.
  ///
  /// If `true` then MapOptions's `maxZoom` should be `maxZoom - 1` since retinaMode
  /// just simulates retina display by playing with `zoomOffset`.
  /// If geoserver supports retina `@2` tiles then it it advised to use them
  /// instead of simulating it (use {r} in the [urlTemplate])
  ///
  /// It is advised to use retinaMode if display supports it, write code like this:
  /// TileLayerOptions(
  ///     retinaMode: true && MediaQuery.of(context).devicePixelRatio > 1.0,
  /// ),
  final bool retinaMode;

Moreover if retina is enabled then MapOptions's maxZoom should be maxZoom - 1, currently MapState doesn't detect any maxZoom based on Layers like Leaflet (If not specified and at least one GridLayer or TileLayer is in the map, the highest of their maxZoom options will be used instead.).

retina

Note: this PR needs #584 so merge this only when it is accepted.

closes #212

Comment thread lib/src/layer/tile_provider/tile_provider.dart Outdated
@matthiasdittmer
Copy link
Copy Markdown
Contributor

matthiasdittmer commented Apr 14, 2020

@maRci002 @HugoHeneault I compared rendering quality of this Flutter lib to the native osmdroid lib a few weeks.

The map looked better and more crisp on osmdroid (same bounding box). Is this related to this density fix?

I traced down the complete widget tree to find the issue (image resize algorithm, ...).

@maRci002
Copy link
Copy Markdown
Contributor Author

maRci002 commented May 6, 2020

#584 updated so I merged that into this to avoid conflicts whenever they got approved.

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.

add support for detectRetina display

5 participants