Coder Social home page Coder Social logo

gregallensworth / l.control.boxzoom Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 11.0 27 KB

A Leaflet control to do a box zoom. Not everyone knows about holding down Shift, and prefer to have a visible, clickable button to do box zooms.

License: MIT License

HTML 100.00%

l.control.boxzoom's People

Contributors

avidspartan1 avatar gregallensworth avatar restimel avatar vthib avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

l.control.boxzoom's Issues

Integrate it to leaflet package of R

This is very nice feature that I was looking to implement but since I am using rmarkdown and leaflet package I am having tremendous difficulties to make this work within RStudio and leaflet package. I am not sure if you or leaflet package maintainers could help me solve this issue? I would like to use the zoom box in this map: https://emdelponte.github.io/FGSC-database/

While boxzoom is active, allow Shift+Drag to pan

We're using this package (Great work, BTW) to keep boxzoom activated on a map so that the users can drag a box to search for markers in an area. This works great. What we now want to do is allow the user to hold Shift while dragging to activate pan mode in Leaflet. I thought this would be easy by doing this:

document.addEventListener('keydown', function(e) {
    // Disable box zoom while shift is pressed
    if(e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
        self.map.boxZoom.setStateOff();
    }
});
document.addEventListener('keyup', function(e) {
    // Disable box zoom while shift is pressed
    if(e.code === 'ShiftLeft' || e.code === 'ShiftRight') {
        self.map.boxZoom.setStateOn();
    }
});

This does successfully disable boxzoom while shift is pressed, and does activate the cursor pointer, but dragging doesn't actually do anything. It doesn't boxzoom AND it doesn't pan. What am I doing wrong here?

Thanks in advance!

zoomAnim Event

The zoomAnim event is not being fired after the map has loaded, and an area is being zoomed to using leaflet-control-boxzoom...

Even if an area is scroll-zoomed to, then BoxZoomed, the zoomAnim event is not fired for the BoxZoom zoom, the first time it is used.

Demo in HTTPS?

Hi!

I was curious about this plugin but I noticed that the demo page does not work in HTTPS:

I think we have just some resources hardcoded in http and should be an easy fix. Anyway now I cannot give more help.

Thank you so much :) Very interesting plugin! In HTTP it still works.

Mouse pointer

Any chance of changing the pointer to something else, for example a '+' or something when box zoom button is clicked? The default (hand) pointer is kinda confusing to end users. Otherwise a great plugin πŸ‘

Add a small demo page

I think more people would consider using it if there was a little demo page to see what it does and how it looks like.

Zoom out by box

Hi,
First, thanks for your plugin, it’s very useful.
But I have one question; do you think it’s possible to do a zoom out by box?
Do you have some ideas?
Thanks.

keepOn option does not work

Thanks for a great plugin. Just letting you know the keepOn option does not work. When set to true in the control it does not change the behaviour from default behaviour.
ctlZoomBox = L.Control.boxzoom({ position:'bottomright', keepOn:true}).addTo(map);

Cursor issue for svg path elements

Leaflet uses "cursor: pointer" in the class .leaflet-interactive on svg path elements. This overrides the "cursor: crosshair !important" for .leaflet-container.leaflet-control-boxzoom-active. This means that when trying to create a box zoom over svg path elements the cursor will flip back and forth between crosshair and pointer.

Adding an additional selector for .leaflet-interactive for the path element worked around the issue for us. Not sure if there's a better way though.

.leaflet-container.leaflet-control-boxzoom-active,
.leaflet-container.leaflet-control-boxzoom-active path.leaflet-interactive {
cursor:crosshair !important;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.