- Fix: do not prevent default wheel behavior when the camera is fixed.
- Fix return value of
tick()
for programmatic changes while interactive panning and zooming is fixed.
- Avoid preventing wheel events when
isZoom
isfalse
. - Allow zooming when holding SHIFT
- Fix a bug preventing rotation in certain edge cases.
- Fix incorrect default value of
isPanInverted
introduced in v2.2.0 to be backward compatible
- Make sure that
camera.tick()
only returnstrue
when the user effectively panned or rotated
- Allow inverting the horizontal and vertical panning direction via
isPanInverted: [false, true]
. This can be useful in conjunction with WebGL. - Fix a glitch during panning when the mouse cursor leaves the
<canvas />
element.
- Make sure that
tick()
returnstrue
when thecamera
has been changed programmatically
- Hotfix for v2.0.2!
- Fix incorrect mouse position when zooming without having focus the browser window.
Important:
- Revert the deprecation of
refresh()
. Please callcamera.refresh()
when thecanvas
element was resized. This allows speeding up mouseMove and wheel event handler by avoiding an expensivegetBoundingClientRect()
call.
- Fix laggy drag behavior, which was caused by incorrect updates of
previousMouseX
andpreviousMouseY
- Support x and y independent panning and zooming via
isPan: [isPanX, isPanY]
andisZoom: [isZoomX, isZoomY]
Breaking Changes:
- New major version due to
camera-2d-simple
being bumped tov3
. For details see the change log.
- Avoid calling
refresh
internally as it's not needed.
- Fix an issue with zooming in situations with nested scroll bars. Note, this change makes
refresh()
irrelevant. You do not need to call it anymore.
- Fix an issue in switching between
defaultMouseDownMoveAction
- Fix an issue with the zoom center when the page is scrolled
- Change panning and rotating modification behavior:
- The default bahvior on mouse down + move is now defined via
defaultMouseDownMoveAction
, which ispan
by default and can also berotate
- To dynamically switch the behavior to
rotate
orpan
via a modifier key,rotateKey
is now renamed tomouseDownMoveModKey
, which is by defaultalt
- The default bahvior on mouse down + move is now defined via
- Allow changing the modifier key for rotating the camera via
rotateKey
. Valid keys arealt
,shift
,ctrl
, andcmd
- Fix incorrect default parameters for
viewCenter
andscaleBounds
- Add
scaleBounds
option to the constructor for limiting the scale extent
Important
-
Rename this package from
canvas-camera-2d
todom-2d-camera
-
Add
isNdc
option, which is set totrue
by default. If set tofalse
the camera is working in pixel coordinates -
Add
viewCenter
option to the constructor for working in pixel coordinates -
Add the following options for event handlers to be fired after the camera has updated:
onKeyDown
onKeyUp
onMouseDown
onMouseUp
onMouseMove
onWheel
-
Decrease dependencies on 3rd-party packages
- Update camera-2d to
v2.0
- Replace
key-pressed
withis-key-down
- Fix regression regarding
config()
- Remove
camera.getGlPos()
as the base application should handle this since it typically involves a projection + model transformation
- Adjust mouse coordinates by aspect ration to support typical projection view model setups.
- Update camera-2d-simple to
v2
and adjust code - Allow setting the rotation on create
- Add rotation by ALT + mouse dragging
- Remove zoom by ALT + mouse dragging
- [Breaking change] the camera must now be configured using
camera.config({ ... })
. - Change to prettier code style.
- Allow fixing the camera position when
camera.isFixed === true
.
- First working version with pan and zoom. Note that rotation doesn't work yet.