Skip to content

0.0.2

Compare
Choose a tag to compare
@niklasramo niklasramo released this 23 Nov 07:02
· 27 commits to main since this release

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.