Coder Social home page Coder Social logo

mazemap / leaflet.layergroup.collision Goto Github PK

View Code? Open in Web Editor NEW
96.0 96.0 39.0 766 KB

Leaflet plugin for uncluttering L.Markers using basic collision detection.

License: MIT License

JavaScript 100.00%
collision-detection javascript leaflet leaflet-plugins

leaflet.layergroup.collision's People

Contributors

dagjomar avatar gustavat avatar ivansanchez avatar simon04 avatar turban 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leaflet.layergroup.collision's Issues

Give option to use onZoom instead of onZoomEnd

On touch devices the collision detection doesn't work while zooming until you lift up your fingers.
Therefore it would be nice to switch to onZoom as a trigger instead of using onZoomEnd.

The demo page is broken

I got this on my console when opening the demo page

Uncaught ReferenceError: L is not defined
    <anonymous> https://mazemap.github.io/Leaflet.LayerGroup.Collision/demo/demo.html:49

Compatibility with L.Tooltip

It would be desirable to make L.Tooltips from Leaflet 1.0.x and LayerGroup.Collision compatible - read collision boxes from labels, not assuming they are marker icons.

GeoJSON.Collision throws `Cannot read property` errors

It seems that the GeoJSON version of this addon can't find the extended properties on itself. Simply calling L.geoJSON.collision(...) throws

Uncaught (in promise) TypeError: Cannot read property 'push' of undefined
    at NewClass.addLayer (collision.js:26)
    at NewClass.addData (GeoJSON.js:127)
    at NewClass.addData (GeoJSON.js:104)
    at NewClass.initialize (GeoJSON.js:89)
    at NewClass.initialize (collision.js:9)
    at new NewClass (Class.js:22)
    at Function.L.geoJson.collision (collision.js:240)
    at main.js:27

I noticed there's only ever been one issue regarding GeoJSON on this repository, the one that added conditional calling of the parent constructor if the parent class was GeoJSON. But it doesn't seem to make any difference either way whether that patch is used or not.

Demo page does not work over https

Chrome complains about loading insecure elements. Seems there are "http" urls hard coded in the page.

Can easily work around, but with Googles push to the encrypted internet might be worth fixing.

Combinable with Angular?

Is it possible to use this with the 'ngx-leaflet' package for Angular?
If so, please let me know! :)

Have a great day!

Rbush 2.x compatibility

Hi;

I just installed Rbush latest version ( 2.0.1 ) as a dependency, and it's not working out of the box. Adding support for 2.x or bundling with the old version would be great.

Best,
Chris

Box references are not removed from rbush

The removeLayer() function tries to remove the cached relative box from the rbush, but the _maybeAddLayerToBush() function inserts the calculated position (latLngToLayerPoint()-offset).
The items stored in the rbush differ from the cached ones and will never get removed.

Tested with Leaflet 1.0.3.

new releases for last commits

Hello,

Can you please add a new release for your last commits please ?

I would like to deploy your work on http://www.webjars.org/npm so that your library can be used as a maven dependency, but webjars only scans for releases on github.

Thank you for your great work !

Uncaught ReferenceError: rbush is not defined

I installed the latest version via npm and required via Browserify:

require('leaflet.layergroup.collision')

I got the following error:

Uncaught ReferenceError: rbush is not defined

I could workaround by changing the require part to the following:

global.rbush = require('rbush')
require('leaflet.layergroup.collision')

How to safely deactivate the plugin/remove from map

How do we safely remove the plugin in the map after we use it?

I tried removing it through: map.removeLayer(collisionLayer);, the labels are remove, but the rendering is messedup such that it affects other markers previously loaded on the map.

When I tried zooming, i encounter the following error after removing collisionLayer

Leaflet.LayerGroup.Collision.js:164 Uncaught TypeError: Cannot read property 'getZoom' of null
    at e._onZoomEnd (Leaflet.LayerGroup.Collision.js:164)
    at e.fire (Events.js:186)
    at e._moveEnd (Map.js:1184)
    at e.<anonymous> (Map.js:1628)

Add smooth transitions

Would be great to have smooth transitions (fade in / fade out).
Maybe adding a CSS class to colliding/hidden elements or using a callback on collision could be alternative solutions to this instead of removing the entire element from DOM.

Cheers.

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.