Sha256: c9972c5a79da09dcea0c9ce175f067c09a6d68aa8b1c02e2982d2552a970572f

Contents?: true

Size: 971 Bytes

Versions: 7

Compression:

Stored size: 971 Bytes

Contents

sitemap.behavior = sitemap.behavior || {};

sitemap.behavior.mouseWheel = function() {
  var delta, eventName;
  var dispatch = d3.dispatch("wheel");

  function behavior(g) {
    g.on(eventName + ".mouseWheelBehavior", onWheel);
  }

  function onWheel() {
    d3.event.preventDefault();

    dispatch.wheel({
      delta: delta(),
      point: d3.mouse(this),
      ctrlKey: d3.event.ctrlKey,
      shiftKey: d3.event.shiftKey,
      altKey: d3.event.altKey
    });
  }

  if ('onwheel' in window.document) {
    delta = function() {
      return -(d3.event.deltaY || d3.event.deltaX) * (d3.event.deltaMode ? 120 : 1);
    };
    eventName =  'wheel';
  }
  else if ('onmousewheel' in window.document) {
    delta = function() {
      return d3.event.wheelDelta;
    };
    eventName = 'mousewheel';
  }
  else {
    delta = function() {
      return -d3.event.detail;
    };
    eventName = 'MozMousePixelScroll';
  }

  return d3.rebind(behavior, dispatch, 'on');
};

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pageflow-sitemap-1.5.0 app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/mouse_wheel.js
pageflow-sitemap-1.4.0 app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/mouse_wheel.js
pageflow-sitemap-1.3.0 app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/mouse_wheel.js
pageflow-sitemap-1.2.0 app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/mouse_wheel.js
pageflow-sitemap-1.1.0 app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/mouse_wheel.js
pageflow-sitemap-1.0.0 app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/mouse_wheel.js
pageflow-sitemap-0.1.0 app/assets/javascripts/pageflow/sitemap/editor/d3/behaviors/mouse_wheel.js