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

Fix doc + address one revdep issue + expose control.collapse #1016

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 2 commits into from
Jan 7, 2025

Conversation

olivroy
Copy link
Contributor

@olivroy olivroy commented Jan 3, 2025

Before, we would get this in view mode

Error in if (title != "") { : argument is length 0

@olivroy olivroy changed the title Fix doc + address one revdep issue. Fix doc + address one revdep issue + improve error message and expose control.collapse Jan 3, 2025
@mtennekes
Copy link
Member

mtennekes commented Jan 3, 2025

Thx!

  • I didn't know the %||% operator. Seems very handy! Probably could replace hundreds of tmap code lines :-)
  • Your control.position cli_abort seems the other way round: the tmap standard (which deviated from leaflet) is c(<horizontal>, <vertical>)

We could also replace all stops with cli_aborts, but that has low priority...

@olivroy

This comment has been minimized.

@olivroy
Copy link
Contributor Author

olivroy commented Jan 6, 2025

Oops, I see what you mean now. The error message is still not accurate. I will leave that part out for now until I do more experimentation...

I would just have expected this to work...

# confusing leaflet error message
map +
    tm_view(control.bases = c("shp1", "shp2"), control.collapse = TRUE, control.position = c("top","right"))
#> Error in match.arg(position): 'arg' doit être un de "topright", "bottomright", "bottomleft", "topleft"

instead of this

map +
    tm_view(control.bases = c("shp1", "shp2"), control.collapse = TRUE, control.position = c("right","top"))

but somehow order is mixed, and I don't want to make things worse. Leaving as is for now.

@olivroy olivroy changed the title Fix doc + address one revdep issue + improve error message and expose control.collapse Fix doc + address one revdep issue + expose control.collapse Jan 6, 2025
mtennekes added a commit that referenced this pull request Jan 6, 2025
@mtennekes
Copy link
Member

Solved it the chameleon way: 4f5fa7e (

Now it accepts both c("right", "top") and c("top", "right"). This should apply to all position arguments that are short cutted via a 2-length character. Not sure if we should add a message that the former is the preferred order....

@olivroy
Copy link
Contributor Author

olivroy commented Jan 6, 2025

This is great! thanks for addressing this! I will investigate to see if a message / warning is required.

@olivroy
Copy link
Contributor Author

olivroy commented Jan 6, 2025

Are you ok merging this? I removed my commit on position.

@mtennekes mtennekes merged commit 2f25d9f into master Jan 7, 2025
7 checks passed
@Nowosad Nowosad deleted the doc-oli branch January 7, 2025 09:17
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