Comments (5)
Thanks @jgravois. Looking into it. 🔍
from leaflet.shapemarkers.
@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?
- Create an instance of L.SVG:
var svgRenderer = L.svg();
- 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.
cc/ @jwasilgeo
from leaflet.shapemarkers.
@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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet.shapemarkers.