Context menu for SVG elements
✓ Published0🌍 Public
FFrissAnalytics
Last edited Sep 30, 2018
Created on May 16, 2017
A context menu appears at the mouse cursor when the user right-clicks a central square in an SVG canvas. The menu, built with D3 v3, lists three text items and is styled with hover effects. The code defines a reusable `contextMenu` function that automatically measures text to size menu entries, and attaches the menu using D3's `on('contextmenu')` event with `d3.event.preventDefault()`. Clicking anywhere else on the body removes the menu.
AI-generated descriptionforked from <a href='http://bl.ocks.org/jakosz/'>jakosz</a>'s block: <a href='http://bl.ocks.org/jakosz/ce1e63d5149f64ac7ee9'>Context menu for SVG elements</a>
mit Licensed