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

Zoom in the map component does not work? #378

Closed
amrutadotorg opened this issue Jun 6, 2024 · 3 comments
Closed

Zoom in the map component does not work? #378

amrutadotorg opened this issue Jun 6, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@amrutadotorg
Copy link
Contributor

Hi, while developing the page with the map component, I found that the zoom attribute does not work if the second select statement is present. Is this intentional?

thank you

Screenshot 2024-06-06 at 12 33 40

select 
    'map'   as component,
    'New Delhi-1' as title,
    28.6139     as latitude,
    11     as zoom,
    77.209      as longitude;
select 
    'map' as component,
    'New Delhi-2  ' as title,
    11     as zoom;
select 
    28.6139     as latitude,
    77.209      as longitude;
@amrutadotorg amrutadotorg added the enhancement New feature or request label Jun 6, 2024
@lovasoa
Copy link
Collaborator

lovasoa commented Jun 7, 2024

Hello !
I think there is a confusion here. The zoom level is the same on both your screenshots. The attribute 11 as zoom did work in both cases. The only difference is in where the map is centered. In the first example, you provided latitude and longitude as top-level attributes, so the map is centered at the place you specified.

image

In the second example, you did not provide a latitude and longitude as top level attributes, so the map is still zoomed to zoom level 11, but centered on "lat=48,lng=3" (the default value when no top-level latitude and longitude are provided).

The second query adds pins to the map, and in the second example, if you manually center the map on New Dehli, you'll see that the point was successfully created.

In the end, what you want is probably to specify both top-level and row-level coordinates to create a pin and center the map on it:

select 
    'map'   as component,
    'New Delhi-3' as title,
    11     as zoom,
    28.6139     as latitude,
    77.209      as longitude;
select 
    28.6139     as latitude,
    77.209      as longitude;

Screen Shot 2024-06-07 at 08 00 43

@lovasoa lovasoa closed this as completed in ed9a367 Jun 7, 2024
@lovasoa
Copy link
Collaborator

lovasoa commented Jun 7, 2024

I updated the default behavior to remove the default centering on "lat=48,lng=3" which was confusing. Now when top-level coordinates are omitted, the map centers on the pins that you add to it.

Now this

select 
    'map'   as component,
    'New Delhi-1' as title,
    28.6139     as latitude,
    11     as zoom,
    77.209      as longitude;

select 
    'map' as component,
    'New Delhi-2  ' as title,
    11     as zoom;
select 
    28.6139     as latitude,
    77.209      as longitude;


select 
    'map'   as component,
    'New Delhi-3' as title,
    28.6139     as latitude,
    11     as zoom,
    77.209      as longitude;
select 
    28.6139     as latitude,
    77.209      as longitude;

select 
    'map'   as component,
    'New Delhi-4' as title,
    28.6139     as latitude,
    77.209      as longitude;

select 
    'map'   as component,
    'New Delhi-5' as title;
select 
    28.6139     as latitude,
    77.209      as longitude;

displays like that:

image

@amrutadotorg
Copy link
Contributor Author

awesome, thank you for the explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants