MCPcopy Create free account
hub / github.com/plotly/plotly.js / attachDragBehavior

Function attachDragBehavior

src/traces/parcoords/axisbrush.js:336–353  ·  view source on GitHub ↗
(selection)

Source from the content-addressed store, hash-verified

334}
335
336function attachDragBehavior(selection) {
337 // There's some fiddling with pointer cursor styling so that the cursor preserves its shape while dragging a brush
338 // even if the cursor strays from the interacting bar, which is bound to happen as bars are thin and the user
339 // will inevitably leave the hotspot strip. In this regard, it does something similar to what the D3 brush would do.
340 selection
341 .on('mousemove', function(d) {
342 d3.event.preventDefault();
343 if(!d.parent.inBrushDrag) mousemove(this, d);
344 })
345 .on('mouseleave', function(d) {
346 if(!d.parent.inBrushDrag) clearCursor();
347 })
348 .call(d3.behavior.drag()
349 .on('dragstart', function(d) { dragstart(this, d); })
350 .on('drag', function(d) { drag(this, d); })
351 .on('dragend', function(d) { dragend(this, d); })
352 );
353}
354
355function startAsc(a, b) { return a[0] - b[0]; }
356

Callers

nothing calls this directly

Calls 5

mousemoveFunction · 0.85
clearCursorFunction · 0.85
dragstartFunction · 0.85
dragendFunction · 0.85
dragFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…