MCPcopy Create free account
hub / github.com/breck7/scroll / beforestart

Function beforestart

external/.d3.js:2817–2862  ·  view source on GitHub ↗
(that, container, event, d, identifier, touch)

Source from the content-addressed store, hash-verified

2815 }
2816
2817 function beforestart(that, container, event, d, identifier, touch) {
2818 var dispatch = listeners.copy(),
2819 p = pointer(touch || event, container), dx, dy,
2820 s;
2821
2822 if ((s = subject.call(that, new DragEvent("beforestart", {
2823 sourceEvent: event,
2824 target: drag,
2825 identifier,
2826 active,
2827 x: p[0],
2828 y: p[1],
2829 dx: 0,
2830 dy: 0,
2831 dispatch
2832 }), d)) == null) return;
2833
2834 dx = s.x - p[0] || 0;
2835 dy = s.y - p[1] || 0;
2836
2837 return function gesture(type, event, touch) {
2838 var p0 = p, n;
2839 switch (type) {
2840 case "start": gestures[identifier] = gesture, n = active++; break;
2841 case "end": delete gestures[identifier], --active; // falls through
2842 case "drag": p = pointer(touch || event, container), n = active; break;
2843 }
2844 dispatch.call(
2845 type,
2846 that,
2847 new DragEvent(type, {
2848 sourceEvent: event,
2849 subject: s,
2850 target: drag,
2851 identifier,
2852 active: n,
2853 x: p[0] + dx,
2854 y: p[1] + dy,
2855 dx: p[0] - p0[0],
2856 dy: p[1] - p0[1],
2857 dispatch
2858 }),
2859 d
2860 );
2861 };
2862 }
2863
2864 drag.filter = function(_) {
2865 return arguments.length ? (filter = typeof _ === "function" ? _ : constant$9(!!_), drag) : filter;

Callers 2

mousedownedFunction · 0.85
touchstartedFunction · 0.85

Calls 1

pointerFunction · 0.85

Tested by

no test coverage detected