Giter VIP home page Giter VIP logo

Comments (5)

jwasilgeo avatar jwasilgeo commented on June 4, 2024 1

Thanks @jgravois. Looking into it. 🔍

from leaflet.shapemarkers.

jwasilgeo avatar jwasilgeo commented on June 4, 2024 1

@swatisahay15, I don't yet understand why this is happening. It seems that a necessary method (_containsPoint) is not available on each layer object during the Leaflet Canvas.js source code that handles mouse interaction events.

If your entire Leaflet map needs to be set to preferCanvas: true, is the following (hopefully temporary) workaround acceptable to you?

  1. Create an instance of L.SVG: var svgRenderer = L.svg();
  2. For each shape marker you add to the map, include the following property in its options: renderer: svgRenderer

For example:

var svgRenderer = L.svg();

L.shapeMarkers.xMarker([45.5052, -122.6917], 50, {
  renderer: svgRenderer
}).addTo(map);

L.shapeMarkers.crossMarker([45.5470, -122.6984], 50, {
  color: 'red',
  renderer: svgRenderer
}).addTo(map);

While the bulk of your map will be in canvas, at least we can get these shape markers to live in a unique <svg> in the map's DOM structure without throwing the errors from Leaflet's Canvas.js.

from leaflet.shapemarkers.

jgravois avatar jgravois commented on June 4, 2024

cc/ @jwasilgeo

from leaflet.shapemarkers.

jwasilgeo avatar jwasilgeo commented on June 4, 2024

@swatisahay15 can you please provide a public example (or html+js code snippet) that would let us debug this and take a closer look?

from leaflet.shapemarkers.

jgravois avatar jgravois commented on June 4, 2024

this isn't a hard one to reproduce. the pen below is just the demo app from the README with the change @swatisahay15 described in the issue title.

var map = L.map('map', { preferCanvas: true })

https://codepen.io/jgravois/pen/bGBaeay

from leaflet.shapemarkers.

Related Issues (6)

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.