这是indexloc提供的服务,不要输入任何密码
Skip to content

Fix for #660 and #441 #680

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

Merged
merged 1 commit into from
Nov 18, 2022
Merged

Conversation

promerpr
Copy link
Contributor

This changes view_add_leaflet_titles to use el.getElementsByClassName rather than document.getElementsByClassName, so we always work within the current leaflet widget. This fixes the issue in #660 and #441 where leaflet titles all float to the top

Without the fix, all the title would go onto the first leaflet widget (code to make the maps is below):
image

image

With the fix, each widget gets one title:
image

image

Code for maps:

library(sf)    
library(tmap)
library(dplyr)


tmap::tmap_mode('view') 
sf::sf_use_s2(use_s2 = FALSE)

data("NLD_prov")

tm_shape(NLD_prov[1:6, ]) +
    tm_polygons("population") +
	tm_layout(title = "Population")
	
tm_shape(NLD_prov[1:6, ]) +
	tm_polygons("pop_0_14", palette = "Blues") +
	tm_layout(title = "Population Under 14")

@Nowosad Nowosad requested a review from mtennekes November 11, 2022 08:14
@mtennekes mtennekes merged commit 145141f into r-tmap:master Nov 18, 2022
@mtennekes
Copy link
Member

Thx a lot @promerpr If you want, you can put down your name as contributor in the description file

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.

2 participants