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

Function drag

src/traces/parcoords/axisbrush.js:229–246  ·  view source on GitHub ↗
(lThis, d)

Source from the content-addressed store, hash-verified

227}
228
229function drag(lThis, d) {
230 d3.event.sourceEvent.stopPropagation();
231 var y = d.height - d3.mouse(lThis)[1] - 2 * c.verticalPadding;
232 var s = d.brush.svgBrush;
233 s.wasDragged = true;
234 s._dragging = true;
235
236 if(s.grabbingBar) { // moving the bar
237 s.newExtent = [y - s.grabPoint, y + s.barLength - s.grabPoint].map(d.unitToPaddedPx.invert);
238 } else { // south/north drag or new bar creation
239 s.newExtent = [s.startExtent, d.unitToPaddedPx.invert(y)].sort(sortAsc);
240 }
241
242 d.brush.filterSpecified = true;
243 s.extent = s.stayingIntervals.concat([s.newExtent]);
244 s.brushCallback(d);
245 renderHighlight(lThis.parentNode);
246}
247
248function dragend(lThis, d) {
249 var brush = d.brush;

Callers 2

dragendFunction · 0.70
attachDragBehaviorFunction · 0.70

Calls 1

renderHighlightFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…