Note that there are some explanatory texts on larger screens.

plurals
  1. POSVG control not visible on top of Leaflet.js
    primarykey
    data
    text
    <p>I'm using Leaflet 0.7.1 and want to draw a radial menu (like openstreetmap's iD editor) on top using d3. Some examples I found use Leaflet's overlayPane to append the svg element to:</p> <pre><code>var svgContainer= d3.select(map.getPanes().overlayPane).append("svg"); </code></pre> <p>On mouseclick, I add the menu and reposition it to the screen xy coords:</p> <pre><code>map.on('contextmenu', function(e) { console.log('contextmenu()'); var tooltip; var center = [e.layerPoint.x, e.layerPoint.y]; var menu = svgContainer.append('g') .attr("class", 'leaflet-zoom-hide') .attr('class', 'radial-menu') .attr('transform', 'translate(' + center + ')') .attr('opacity', 0); menu.transition() .attr('opacity', 1); menu.append('path') .attr('class', 'radial-menu-background') .attr('d', 'M' + r * Math.sin(a0) + ',' + r * Math.cos(a0) + ' A' + r + ',' + r + ' 0 ' + 0 + ',0 ' + (r * Math.sin(a1) + 1e-3) + ',' + (r * Math.cos(a1) + 1e-3)) // Force positive-length path (#1305) .attr('stroke-width', 50) .attr('stroke-linecap', 'round'); }); </code></pre> <p>Somehow, the SVG paths get drawn (this is visible in the Chrome Inspector) but are behind the map object. When I 'drag' the SVG element just below the body tag in Inspector, I <em>can</em> see the circle paths.</p> <p>Any ideas on how I can draw SVG 'menu' elements on top of Leaflet? </p> <p>Thanks!!</p> <p><img src="https://i.stack.imgur.com/PVFTn.jpg" alt="Screenshot"></p> <p>See <a href="http://jsfiddle.net/gnijholt/7WNLt/1" rel="nofollow noreferrer">this fiddle</a> for a demo. Right click or hold to add an invisible element.</p> <p>ps. I asked <a href="https://gis.stackexchange.com/questions/81012/svg-control-not-visible-on-top-of-leaflet-js">this question on gis.stackexchange.com</a>, too.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload