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

Function dragstart

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

Source from the content-addressed store, hash-verified

200}
201
202function dragstart(lThis, d) {
203 d3.event.sourceEvent.stopPropagation();
204 var y = d.height - d3.mouse(lThis)[1] - 2 * c.verticalPadding;
205 var unitLocation = d.unitToPaddedPx.invert(y);
206 var b = d.brush;
207 var interval = getInterval(d, y);
208 var unitRange = interval.interval;
209 var s = b.svgBrush;
210 s.wasDragged = false; // we start assuming there won't be a drag - useful for reset
211 s.grabbingBar = interval.region === 'ns';
212 if(s.grabbingBar) {
213 var pixelRange = unitRange.map(d.unitToPaddedPx);
214 s.grabPoint = y - pixelRange[0] - c.verticalPadding;
215 s.barLength = pixelRange[1] - pixelRange[0];
216 }
217 s.clickableOrdinalRange = interval.clickableOrdinalRange;
218 s.stayingIntervals = (d.multiselect && b.filterSpecified) ? b.filter.getConsolidated() : [];
219 if(unitRange) {
220 s.stayingIntervals = s.stayingIntervals.filter(function(int2) {
221 return int2[0] !== unitRange[0] && int2[1] !== unitRange[1];
222 });
223 }
224 s.startExtent = interval.region ? unitRange[interval.region === 's' ? 1 : 0] : unitLocation;
225 d.parent.inBrushDrag = true;
226 s.brushStartCallback();
227}
228
229function drag(lThis, d) {
230 d3.event.sourceEvent.stopPropagation();

Callers 1

attachDragBehaviorFunction · 0.85

Calls 1

getIntervalFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…