Skip to content

Releases: niklasramo/dragdoll

0.4.0

24 Apr 19:16
2bf8b6f
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.3.0...0.4.0

0.3.0

24 Mar 21:30
eeaa462
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.2.0...0.3.0

0.2.0

16 Dec 12:04
Compare
Choose a tag to compare

0.1.0

09 Jul 16:18
64aad6e
Compare
Choose a tag to compare

Summary

  • Refactored API (quite many breaking changes).
  • Improved TS typing.
  • Updated docs and dependencies.
  • Updated logo.
  • Added some initial tests (although tests in general are still a work in progress).
  • Fixed an issue with auto-scrolling where it could not always detect the end of the scroll.

Breaking changes

  • All clientX and clientY properties across the API are now named simply x and y instead.
  • BaseControllerSensor -> BaseMotionSensor.
  • KeyboardControllerSensor -> KeyboardMotionSensor .
  • BaseSensor.isActive/PointerSensor.isActive are removed, note that this affects to all classes that inherit from them. You can now instead use BaseSensor.drag/PointerSensor.drag property to check if drag is active. If it's null drag is inactive, otherwise it's active.
  • BaseSensor.clientX and BaseSensor.clientY are now moved within a new public BaseSensor.drag property, which is an object containing those two porperties when drag is active. When drag is not active BaseSensor.drag is null.
  • PointerSensor's pointerId, pointerType, clientX and clientY properties are now moved within PointerSensor.drag property when drag is active. When drag is not active PointerSensor.drag property is null.
  • BaseMotionSensor.speed and BaseMotionSensor.direction are now protected properties instead of public properties and prefixed with an underscore.
  • BaseMotionSensor.timeand BaseMotionSensor.deltaTime properties are now moved within BaseMotionSensor.drag property when drag is active.
  • Draggable settings renamed:
    • getElementStartPosition -> getStartPosition.
    • setElementPosition -> setPosition.
    • getElementPositionChange -> getPositionChange.
  • draggable.use method functionality changed a bit. Typing is better now, but plugin has more responsibility.
  • draggable.plugins property is now a plain object instead of a Map.
  • draggable.synchronize() -> draggable.updatePosition().

0.0.2

23 Nov 07:02
Compare
Choose a tag to compare

Overview

  • A lot of the API surface was rewritten with thought and care.
  • Proper docs are now available at https://niklasramo.github.io/dragdoll/. Still missing a few bits, but the core API is pretty well documented.
  • Added a plugin system to Draggable class, which allows extending it's functionality.
  • Separated Draggables autoscroll feature to a separate plugin so that you don't have to load all the autoscroll code if you don't need it (as it's quite a chunk of code).

Breaking changes

  • All sensors
    • Promoted _isActive property from private to public -> isActive.
    • Promoted _isDestroyed property from private to public -> isDestroyed.
  • Draggable
    • Changed option name: destroyElements -> releaseElements.
    • Changed option name: getElementPosition -> getElementStartPosition.
    • Changed option name: renderElementPosition -> setElementPosition.
    • Changed arguments for all option callbacks, they all now receive a single data argument, which is an object containing all the data you might need in that specific callback. This change was made because the amount of individual arguments was getting a bit out of hand and was becoming confusing for the end user to manage.
    • Remove autoScroll option and baked all that functionality into a separate autoscroll plugin.
    • Remove isActive method.
    • Remove getDragData method.
    • Rename _drag property to drag and make it public.
  • BaseSensor
    • To make TypeScript happy in certain situations _start, _move, _end and _cancel protected methods now need the full event data object as argument which includes the type property too.
  • Sensor
    • Changed the type of the on method to be less strict about the emitter implementation -> the method's return type was changed tovoid and the third (optional) listenerId argument removed. The types were previously modeled based on the event emitter used internally by DragDoll, but it made sense to make this part less specific and leave more room for impelementation details.
  • KeyboardMotionSensor
    • Renamed the whole class to KeyboardControllerSensor.
    • speed option renamed to computeSpeed.
    • tickTime property renamed to time.
    • tickDeltaTime property renamed to deltaTime.
    • directionX and directionY properties replaced by direction porperty, an object with x and y` components which is assumed to be the current direction (unit) vector.
    • speedX and speedY properties replaced by speed property.
    • tick method renamed to _tick and demoted as protected property.

New features

  • KeyboardSensor
    • Added new option, moveDistance, which allows you to define the default distance the sensor is moved per "move" event during dragging.
  • Draggable
    • Added plugin system which can be used via the use method.
    • Added autoscroll plugin as the first plugin.
  • AutoScroll
    • Allow autoscroll targets to define a virtual padding for determining if they are overlapping the dragged item or not.
  • Add new base sensor class BaseControllerSensor.

0.0.1

30 Aug 21:23
Compare
Choose a tag to compare

It's born! Still in very experimental phase, please don't use in production.