Atrament v4.4.1
This release bundles Atrament with a target platform specified for rollup-plugin-web-worker-loader.
This fixes #103 (thanks @ak37165 for the issue) and also decreases the final bundle size slightly, because code to check whether the code is executing under Node.js isn't bundled. This code wasn't necessary in the first place, because Atrament is only supposed to execute in browsers.
Atrament v4.4.0
This release fixes #101 reported and fixed by @nichoth 🙏
Atrament v4.3.0
This release fixes #99 as reported by @nichoth, who also kindly provided the fix 🙏
Atrament v4.2.0 🥦
Almost managed to release this one on the correct date!
This version makes one important change for applications where the canvas is not taking up the whole screen. If the pointer leaves the canvas (Atrament handles the pointerout event), Atrament will now end the stroke, instead of pretending it continues. This helps avoid unexpected stroke paths when returning to the canvas.
Another fix I made was that Atrament now "forgets" the previous mouse position even if the pointerup
event fires when the pointer is outside of the element. This prevents unexpected stroke paths when beginning a new stroke.
Atrament v4.1.0
This version should fix #98 - it changes how the dirty
flag behaves, as it's now toggled in the draw()
method. This means it will also be true if drawing programmatically, not just when using a pointer (mouse/touch/stylus).
Another change is that the clear()
method now clears the canvas regardless of whether Atrament has drawn on it. I believe this will lead to more predictable behaviour. The method has also been refactored to take into account the canvas transform.
Atrament v4.0.1
This release changes the license to MIT. I was a silly 22-year-old when I initially released Atrament, licensing it under Phil Sturgeon's DBAD License because I found it funny. I did not anticipate that, years later, Atrament would have 1.4k stars and be used by over 100 projects just publicly listed on GitHub, and potentially many more.
While I still like the DBAD License and find it funny, I don't think it's the best idea for a serious OSS project's license to include that sort of language. I don't particularly want Atrament's users to buy me pints, even though I do like beer a lot. It would also exclude all the other wonderful people who contributed to the library over the years.
I chose the MIT License because:
- in terms of real world consequences, it's not really very different from DBAD
- it is the most common OSS license and I think it's fine
While I think license changes should normally result in a major version upgrade (some people even suggest publishing a new package), I find this to be a negligible change for even the most legally restrictive organisations, and could not justify a major bump, so I'm simply doing this as a patch. I'd be happy to address any concerns raised via GitHub issues.
Atrament v4.0.0
This version brings the biggest overhaul of Atrament since its first release in 2016. Much of the library has been completely rewritten, the look & feel of the drawing has changed significantly and many optimisations have been made.
- Atrament now only supports evergreen browsers (Firefox, Chrome and Chromium-based browsers) and Safari 15 or above. If your application must support older browsers, please use version 3.
- the
Atrament
class is now a default export - the
mode
setter now only accepts symbols exported from the library (e.g.MODE_DRAW
). If anything else is passed, an error is thrown. - the stroke object now stores an array of
segments
, instead ofpoints
. Each segment then contains apoint
. This should clarify the data model and help avoid repetitive code such asstroke.points.forEach((point) => point.point)
. - because of the above, the
pointdrawn
event has been renamed tosegmentdrawn
- the
toImage()
method has been removed - please usecanvas.toDataURL()
to achieve the same effect - the
isDirty()
method has been replaced by thedirty
getter, making it more consistent with the rest of the API - the
Atrament
class now uses private fields and methods. A number of undocumented fields+methods are now not accessible from the outside.
- if
adaptiveStroke
is enabled (default), Atrament now responds to the pointer's pressure by changing the stroke thickness. This is useful when using pressure-sensitive input methods such as the Apple Pencil. - stroke segments are now drawn as individual paths. This means strokes tend to start thin, then thicken and get thinner again towards the end, which is closer to the behaviour of an ink pen.
- strokes are always at least as thick as the
weight
setting in pixels, leading to a more consistent drawing feel especially when drawing finer details.
- Atrament is now built with Rollup and the code is not transpiled (other than separate ES Module and CommonJS bundles).
- Atrament now uses Pointer Events instead of the specific mouse+touch event handlers. This allows us to increase drawing precision, solve a number of bugs and reduce code complexity.
- Fill mode is now implemented with a Web Worker bundled together with the library. This stops the fill algorithm from blocking the main thread.
- Error messages are now prefixed with
atrament:
Atrament v3.0.0
This release adds a pointdrawn
event when recording strokes (#77) and changes the library API so the Atrament
class is a named export. This made it easier for us to upgrade to webpack 5.
Atrament v2.0.0
And after a long time, a major release! This time @panglesd has added timing information to the strokerecorded
event (see #75). This means points
is now an array of "record" objects which contain the point
and time
, which represents the relative timestamp in milliseconds from the beginning of the stroke.
Additionally, a number of dependabot security updates have been merged.
Atrament v1.4.0
This update fixes an undesired behaviour where stroke events were recorded when clicking outside of the canvas, and strokes were drawn even if the mouse has been pressed outside of the canvas, too. Thanks @future-cyborg for diagnosing and fixing this!