MCPcopy Index your code
hub / github.com/plotly/plotly.js / mouseDownHandler

Function mouseDownHandler

src/components/sliders/draw.js:467–507  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

465 }
466
467 function mouseDownHandler() {
468 var sliderOpts = getSliderOpts();
469 gd.emit('plotly_sliderstart', {slider: sliderOpts});
470
471 var grip = sliderGroup.select('.' + constants.gripRectClass);
472
473 d3.event.stopPropagation();
474 d3.event.preventDefault();
475 grip.call(Color.fill, sliderOpts.activebgcolor);
476
477 var normalizedPosition = positionToNormalizedValue(sliderOpts, d3.mouse(node)[0]);
478 handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, true);
479 sliderOpts._dragging = true;
480
481 function mouseMoveHandler() {
482 var sliderOpts = getSliderOpts();
483 var normalizedPosition = positionToNormalizedValue(sliderOpts, d3.mouse(node)[0]);
484 handleInput(gd, sliderGroup, sliderOpts, normalizedPosition, false);
485 }
486
487 $gd.on('mousemove', mouseMoveHandler);
488 $gd.on('touchmove', mouseMoveHandler);
489
490 function mouseUpHandler() {
491 var sliderOpts = getSliderOpts();
492 sliderOpts._dragging = false;
493 grip.call(Color.fill, sliderOpts.bgcolor);
494 $gd.on('mouseup', null);
495 $gd.on('mousemove', null);
496 $gd.on('touchend', null);
497 $gd.on('touchmove', null);
498
499 gd.emit('plotly_sliderend', {
500 slider: sliderOpts,
501 step: sliderOpts.steps[sliderOpts.active]
502 });
503 }
504
505 $gd.on('mouseup', mouseUpHandler);
506 $gd.on('touchend', mouseUpHandler);
507 }
508
509 item.on('mousedown', mouseDownHandler);
510 item.on('touchstart', mouseDownHandler);

Callers

nothing calls this directly

Calls 3

getSliderOptsFunction · 0.85
handleInputFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…