(gd, path, plotinfo)
| 193 | } |
| 194 | |
| 195 | function forwardHoverClickAnywhere(gd, path, plotinfo) { |
| 196 | if (!plotinfo?.id) return; |
| 197 | |
| 198 | const node = path.node(); |
| 199 | |
| 200 | // Fx.hover/Fx.click compute plot-area pixel coordinates from |
| 201 | // evt.clientX/Y relative to evt.target's bounding box. |
| 202 | // The shape path's bbox differs from the plot area, so we |
| 203 | // re-target events to the subplot's nsewdrag element. |
| 204 | function patchedEvt(evt) { |
| 205 | const mainPlot = plotinfo.mainplotinfo || plotinfo; |
| 206 | const nsew = mainPlot?.draglayer?.select('.nsewdrag').node(); |
| 207 | if (!nsew) return null; |
| 208 | |
| 209 | return { clientX: evt.clientX, clientY: evt.clientY, target: nsew }; |
| 210 | } |
| 211 | |
| 212 | node.addEventListener('mousemove', (evt) => { |
| 213 | if (gd._dragging) return; |
| 214 | if (gd._fullLayout.hoveranywhere) { |
| 215 | const e = patchedEvt(evt); |
| 216 | if (e) Fx.hover(gd, e, plotinfo.id); |
| 217 | } |
| 218 | }); |
| 219 | |
| 220 | node.addEventListener('click', (evt) => { |
| 221 | if (gd._dragged) return; |
| 222 | if (gd._fullLayout.clickanywhere) { |
| 223 | const e = patchedEvt(evt); |
| 224 | if (e) Fx.click(gd, e, plotinfo.id); |
| 225 | } |
| 226 | }); |
| 227 | } |
| 228 | |
| 229 | function setClipPath(shapePath, gd, shapeOptions) { |
| 230 | // note that for layer="below" the clipAxes can be different from the |
no test coverage detected
searching dependent graphs…