How to use the d3-selection.event.clientY function in d3-selection

To help you get started, we’ve selected a few d3-selection examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pbeshai / d3-scale-interactive / src / ui / ArrayInput.js View on Github external
drag(target) {
    const index = parseInt(target.parentNode.getAttribute('data-index'), 10);
    const { values, onChange } = this.props;

    const delta = event.clientY - this.dragStartY;

    // a minimum of 8 pixels of mousemovement to start a drag
    if (Math.abs(delta) < 8) {
      return;
    }

    const oldValues = values;
    let increment = Math.abs(this.dragStartValue * 0.01);

    // if it is an integer, minimum increment is 1
    let isInteger = false;
    if (this.dragStartValue === Math.round(this.dragStartValue)) {
      isInteger = true;
      increment = Math.max(1, Math.round(increment));
    }
github openstreetmap / iD / modules / ui / photoviewer.js View on Github external
return function initResize() {
                startX = d3_event.clientX;
                startY = d3_event.clientY;
                startWidth = target.node().getBoundingClientRect().width;
                startHeight = target.node().getBoundingClientRect().height;

                d3_select(window)
                    .on('mousemove.' + eventName, startResize, false)
                    .on('mouseup.' + eventName, stopResize, false);
            };
        }
github d3 / d3-zoom / src / zoom.js View on Github external
function mousedowned() {
    if (touchending || !filter.apply(this, arguments)) return;
    var g = gesture(this, arguments, true),
        v = select(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true),
        p = mouse(this),
        x0 = event.clientX,
        y0 = event.clientY;

    dragDisable(event.view);
    nopropagation();
    g.mouse = [p, this.__zoom.invert(p)];
    interrupt(this);
    g.start();

    function mousemoved() {
      noevent();
      if (!g.moved) {
        var dx = event.clientX - x0, dy = event.clientY - y0;
        g.moved = dx * dx + dy * dy > clickDistance2;
      }
      g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = mouse(g.that), g.mouse[1]), g.extent, translateExtent));
    }
github d3 / d3-drag / src / drag.js View on Github external
function mousemoved() {
    noevent();
    if (!mousemoving) {
      var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
      mousemoving = dx * dx + dy * dy > clickDistance2;
    }
    gestures.mouse("drag");
  }
github Vizzuality / trase / frontend / scripts / react-components / profile / profile-components / line / line.component.jsx View on Github external
function mouseMove() {
        const bisectDate = bisector(d => d.date).left;
        const x0 = x.invert(mouse(this)[0]);
        const pointIndex = bisectDate(lineValuesWithFormat, x0, 1);
        const d0 = lineValuesWithFormat[pointIndex - 1];
        const d1 = lineValuesWithFormat[pointIndex];
        const dxx = x0 - d0.date > d1.date - x0 ? d1 : d0;

        showTooltipCallback(dxx, d3_event.clientX + 10, d3_event.clientY + scrollOffset() + 10);
      }
github tmrowco / electricitymap-contrib / web / src / main.js View on Github external
.onExchangeMouseMove(() => {
    countryTableExchangeTooltip.update(currentEvent.clientX, currentEvent.clientY);
  })
  .onExchangeMouseOver((d, country, displayByEmissions) => {
github openstreetmap / iD / modules / ui / background_offset.js View on Github external
function dragOffset() {
        if (d3_event.button !== 0) return;

        var origin = [d3_event.clientX, d3_event.clientY];

        context.container()
            .append('div')
            .attr('class', 'nudge-surface');

        d3_select(window)
            .on('mousemove.offset', function() {
                var latest = [d3_event.clientX, d3_event.clientY];
                var d = [
                    -(origin[0] - latest[0]) / 4,
                    -(origin[1] - latest[1]) / 4
                ];

                origin = latest;
                nudge(d);
            })
github pbeshai / d3-scale-interactive / src / ui / ArrayInput.js View on Github external
startDrag(target) {
    const index = parseInt(target.parentNode.getAttribute('data-index'), 10);
    const { values } = this.props;
    this.dragging = target;
    this.dragStartY = event.clientY;
    this.dragStartValue = values[index];
  }
github khartec / waltz / waltz-ng / client / playpen / 4 / svg-manipulator.js View on Github external
const highlighter = () => {
        const mx = event.clientX;
        const my = event.clientY;
        const elementMouseIsOver = document.elementFromPoint(mx, my);
        highlight(elementMouseIsOver);
    };