How to use the vega-scenegraph.point function in vega-scenegraph

To help you get started, we’ve selected a few vega-scenegraph 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 vega / vega / src / view / events-extend.js View on Github external
export default function(view, event, item) {
  var el = view._renderer.element(),
      p, e, pad;

  if (el) {
    pad = view.padding();
    e = event.changedTouches ? event.changedTouches[0] : event;
    p = point(e, el);
    p[0] -= pad.left;
    p[1] -= pad.top;
  }

  return event.vega = extension(view, item, p), event.item = item, event;
}
github vega / vega / src / View.js View on Github external
prototype.extendEvent = function(event, item) {
  event.dataflow = this;
  event.item = item;

  var el = this._renderer.element(), e, p, pad;
  if (el) {
    pad = this.padding();
    e = event.changedTouches ? event.changedTouches[0] : event;
    p = point(e, el);
    event.viewX = p[0] - pad.left;
    event.viewY = p[1] - pad.top;
  }

  return event;
};
github vega / vega / packages / vega-view / src / events-extend.js View on Github external
export default function(view, event, item) {
  var el = view._renderer.canvas(),
      p, e, translate;

  if (el) {
    translate = offset(view);
    e = event.changedTouches ? event.changedTouches[0] : event;
    p = point(e, el);
    p[0] -= translate[0];
    p[1] -= translate[1];
  }

  event.dataflow = view;
  event.vega = extension(view, item, p);
  event.item = item;
  return event;
}