Releases: niklasramo/dragdoll
Releases · niklasramo/dragdoll
0.5.0
0.4.0
0.3.0
0.2.0
0.1.0
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
andclientY
properties across the API are now named simplyx
andy
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 useBaseSensor.drag
/PointerSensor.drag
property to check if drag is active. If it'snull
drag is inactive, otherwise it's active.BaseSensor.clientX
andBaseSensor.clientY
are now moved within a new publicBaseSensor.drag
property, which is an object containing those two porperties when drag is active. When drag is not activeBaseSensor.drag
isnull
.PointerSensor
'spointerId
,pointerType
,clientX
andclientY
properties are now moved withinPointerSensor.drag
property when drag is active. When drag is not activePointerSensor.drag
property isnull
.BaseMotionSensor.speed
andBaseMotionSensor.direction
are now protected properties instead of public properties and prefixed with an underscore.BaseMotionSensor.time
andBaseMotionSensor.deltaTime
properties are now moved withinBaseMotionSensor.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 aMap
.draggable.synchronize()
->draggable.updatePosition()
.
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
.
0.0.1
It's born! Still in very experimental phase, please don't use in production.