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

Added control/layers #34

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

legokichi
Copy link

@legokichi legokichi commented Sep 2, 2024

usage

let opt = &leaflet::TileLayerOptions::new();
opt.set_attribution(r#"© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>"#.to_string());
let osm = TileLayer::new_options("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", opt);
gsi.add_to(&map);
let opt = js_sys::Object::new();
js_sys::Reflect::set(&opt, &JsValue::from("OpenStreetMap"), &JsValue::from(osm)).unwrap();
let control = leaflet::LayersControl::new(&opt);
control.add_to(&map);


impl LayersControl {
#[must_use]
pub fn new(options: &Object) -> Self {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about this?

Suggested change
pub fn new(options: &Object) -> Self {
pub fn new(options: &std::collections::HashMap<String, Layer>) -> Self {

@legokichi legokichi marked this pull request as draft September 2, 2024 19:41
#[must_use]
pub fn new(options: &Object) -> Self {
constructor_layers(options)
}
Copy link
Author

@legokichi legokichi Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo

Suggested change
}
}
pub fn new_with_options(&Object, options: &LayersControlOptions) -> Self {
...
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably this file is not necessary

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.

1 participant