d3-drag

Drag and drop SVG, HTML or Canvas using mouse or touch input.

ISC License

Downloads
16.8M
Stars
332
Committers
9

Bot releases are hidden (Show)

d3-drag - Latest Release

Published by mbostock over 3 years ago

  • Adopt type: module.
  • Update dependencies.
  • Make build reproducible.
  • Declare some event listeners as non-passive. #78

This package now requires Node.js 12 or higher. For more, please read Sindre Sorhus’s FAQ.

d3-drag - v2.0.0

Published by Fil about 4 years ago

See https://observablehq.com/@d3/circle-dragging-ii for an example.

This release adopts ES2015 language features such as for-of and drops support for older browsers, including IE. If you need to support pre-ES2015 environments, you should stick with d3-brush 1.x or use a transpiler.

d3-drag -

Published by mbostock almost 5 years ago

  • Add sideEffects: false to the package.json.
d3-drag -

Published by mbostock about 5 years ago

  • Fix default drag.filter on control-click. #62
  • Fix default drag.touchable if navigator.maxTouchPoints. #47
  • Update dependencies.
  • Adopt exact paths for imports.
  • Adopt explicit files for publishing.
d3-drag -

Published by mbostock about 6 years ago

  • Housekeeping.
d3-drag -

Published by mbostock about 6 years ago

  • Update dependencies.
d3-drag -

Published by mbostock about 7 years ago

d3-drag -

Published by mbostock about 7 years ago

d3-drag -

Published by mbostock over 7 years ago

  • Only register touch event listeners on platforms that support touch.
  • When touch is supported, set the touch-action style to “none”.
d3-drag -

Published by mbostock over 7 years ago

  • Add drag.clickDistance for setting the click distance threshold.
  • Fix click suppression to ignore mousemove events that don’t actually move (#28).
d3-drag -

Published by mbostock over 7 years ago

  • Update dependencies.
d3-drag -

Published by mbostock over 7 years ago

  • Update dependencies.
d3-drag -

Published by mbostock almost 8 years ago

  • Update dependencies.
d3-drag -

Published by mbostock about 8 years ago

  • Add module entry point to package.json.
d3-drag -

Published by mbostock over 8 years ago

  • First stable release.

Changes since D3 3.x

The drag behavior d3.behavior.drag has been renamed to d3.drag. The drag.origin method has been replaced by drag.subject, which allows you to define the thing being dragged at the start of a drag gesture. This is particularly useful with Canvas, where draggable objects typically share a Canvas element (as opposed to SVG, where draggable objects typically have distinct DOM elements); see the circle dragging example.

A new drag.container method lets you override the parent element that defines the drag gesture coordinate system. This defaults to the parent node of the element to which the drag behavior was applied. For dragging on Canvas elements, you probably want to use the Canvas element as the container.

Drag events now expose an event.on method for registering temporary listeners for duration of the current drag gesture; these listeners can capture state for the current gesture, such as the thing being dragged. A new event.active property lets you detect whether multiple (multitouch) drag gestures are active concurrently. The dragstart and dragend events have been renamed to start and end. By default, drag behaviors now ignore right-clicks intended for the context menu; use drag.filter to control which events are ignored. The drag behavior also ignores emulated mouse events on iOS. The drag behavior now consumes handled events, making it easier to combine with other interactive behaviors such as zooming.

The new d3.dragEnable and d3.dragDisable methods provide a low-level API for implementing drag gestures across browsers and devices. These methods are also used by other D3 components, such as the brush.

See CHANGES for all D3 changes since 3.x.

d3-drag -

Published by mbostock over 8 years ago

  • Update dependencies.
d3-drag -

Published by mbostock over 8 years ago

  • Export to the global d3 in vanilla environments (d3/d3#2840).
d3-drag -

Published by mbostock over 8 years ago

  • Only consume handled touch events.
d3-drag -

Published by mbostock over 8 years ago

d3-drag -

Published by mbostock over 8 years ago