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

Upgrade to most recent version of Leaflet #79

Closed
amotl opened this issue Nov 6, 2020 · 2 comments · Fixed by #81
Closed

Upgrade to most recent version of Leaflet #79

amotl opened this issue Nov 6, 2020 · 2 comments · Fixed by #81

Comments

@amotl
Copy link

amotl commented Nov 6, 2020

Hi there,

currently, this repository includes Leaflet 1.3.1 on behalf of the src/libs/leaflet.js file. However, it should be better included by adding it as a runtime dependency into package.json.

Within #78, we are looking at integrating Leaflet-Geoman and I believe it will be a good idea to also bump to the most recent version of Leaflet when/before doing that.

With kind regards,
Andreas.

@amotl
Copy link
Author

amotl commented Nov 6, 2020

When doing this transition, we will have to take care not to lose any changes made to this file on the way [1]. Specifically,
04bcb59 added an autoWidth setting to the Popup options.

// @option autoWidth: Boolean = true
// Set it to `false` if you don't want to compute
// and set the width of a opened popup automatically.
autoWidth: true,

This option, when disabled, will mask the whole section for computing the width for the popup automatically within the _updateLayout method.

if (this.options.autoWidth) {
  style.width = '';
  style.whiteSpace = 'nowrap';

  var width = container.offsetWidth;
  width = Math.min(width, this.options.maxWidth);
  width = Math.max(width, this.options.minWidth);

  style.width = (width + 1) + 'px';
  style.whiteSpace = '';
}

The rationale of this improvement has been outlined at [2] and [3].

Disable automatic width-calculation of popup labels

Toggling the new autoWidthLabels option to false will disable automatic width-calculation of popup labels. This helps controlling the popup rendering not to clip when displayed within narrow-sized maps.

Before/After

image image


[1] https://github.com/panodata/grafana-map-panel/commits/develop/src/libs/leaflet.js
[2] https://community.panodata.org/t/grafana-map-panel/121
[3] https://community.hiveeyes.org/t/developing-grafana-worldmap-ng/1824/5

@amotl
Copy link
Author

amotl commented Nov 8, 2020

34febf7f extracts the autoWidth feature from the core leaflet.js again. If we are lucky, we can now upgrade to a more recent version of Leaflet. Nevertheless, we should ask upstream to add this feature to its code base.

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 a pull request may close this issue.

1 participant