0.0.2
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
Draggable
s 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
.
- Promoted
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 todrag
and make it public.
- Changed option name:
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 thetype
property too.
- To make TypeScript happy in certain situations
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.
- Changed the type of the
KeyboardMotionSensor
- Renamed the whole class to
KeyboardControllerSensor
. speed
option renamed tocomputeSpeed
.tickTime
property renamed totime
.tickDeltaTime
property renamed todeltaTime
.directionX
anddirectionY
properties replaced bydirection
porperty, an object withx and
y` components which is assumed to be the current direction (unit) vector.speedX
andspeedY
properties replaced byspeed
property.tick
method renamed to_tick
and demoted as protected property.
- Renamed the whole class to
New features
KeyboardSensor
- Added new option,
moveDistance
, which allows you to define the default distance the sensor is moved per "move" event during dragging.
- Added new option,
Draggable
- Added plugin system which can be used via the
use
method. - Added autoscroll plugin as the first plugin.
- Added plugin system which can be used via the
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
.