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

Enable zoom on live view of the car. #2184

Merged
merged 6 commits into from
Jan 21, 2022
Merged

Conversation

bogosj
Copy link
Contributor

@bogosj bogosj commented Nov 23, 2021

No description provided.

@silverl
Copy link

silverl commented Jan 8, 2022

@adriankumpf This is a great feature to add. Can you accept this PR?

@adriankumpf
Copy link
Collaborator

Would it be possible to show the zoom buttons only when hovering (or tapping on mobile devices)? This would allow to preserve the clean appearance while offering advanced features, such as the map zoom.

@bogosj
Copy link
Contributor Author

bogosj commented Jan 19, 2022

I'm not sure how to accomplish that. Instead I've changed the options to allow for dragging the map, zooming with scrolling, and zooming with pinch on mobile. Thoughts?

@adriankumpf
Copy link
Collaborator

I like that better. The catch is that it becomes harder to scroll on mobile or small touch devices. It may also surprise you if you are scrolling with the mouse wheel and have just accidentally positioned the cursor over the map.

I can imagine that displaying the controls while hovering might be a good middle ground. For example, you could do it like this:

    const map = createMap({
      // ...
      zoomControl: true,
      // ...
    });


    map.removeControl(map.zoomControl);

    map.on('mouseover', function(e) { map.addControl( map.zoomControl ); });
    map.on('mouseout', function(e) { map.removeControl( map.zoomControl ); });

@bogosj
Copy link
Contributor Author

bogosj commented Jan 21, 2022

Agreed, it's pretty nice this way.

Copy link
Collaborator

@adriankumpf adriankumpf left a comment

Choose a reason for hiding this comment

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

Cool! Thank you.

@adriankumpf adriankumpf merged commit 963831d into teslamate-org:master Jan 21, 2022
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.

3 participants