jakubfiala/atrament
 Watch   
 Star   
 Fork   
2 days ago
atrament

Atrament v4.3.0

This release fixes #99 as reported by @nichoth, who also kindly provided the fix 🙏

22 days ago
atrament

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.

2024-03-28 18:21:41
atrament

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.

2024-03-24 06:44:22
atrament

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:

  1. in terms of real world consequences, it's not really very different from DBAD
  2. 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.

2024-03-19 18:43:23
atrament

Atrament v4.0.0

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.

Breaking API changes

  • 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 of points. Each segment then contains a point. This should clarify the data model and help avoid repetitive code such as stroke.points.forEach((point) => point.point).
  • because of the above, the pointdrawn event has been renamed to segmentdrawn
  • the toImage() method has been removed - please use canvas.toDataURL() to achieve the same effect
  • the isDirty() method has been replaced by the dirty 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.

Drawing experience changes

  • 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.

Other changes

  • 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:
2023-01-09 20:06:21
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.

2021-09-12 23:18:01
atrament

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.

2020-11-01 18:48:14
atrament

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!

2020-11-01 18:31:29
atrament

Atrament v1.3.0

This update adds the option to set the mode to disabled #60 #61. In this mode, no modifications are made to the canvas, but drawing is still tracked and the expected stroke events still fire. Thanks @uriberto for both suggesting and implementing this feature!

2020-06-01 18:41:49
atrament

Atrament v1.2.0

This release removes mentions of the opacity option, which was removed in v1.0.0. I believe the option wasn't very useful, because the way Atrament draws the strokes is via many composite curves, which may overlap. When using the globalAlpha setting, this means the resulting stroke doesn't have uniform opacity, but is rather composed of a number of semi-transparent layers.

Thanks @alireza23 for pointing out the broken opacity slider in the demo (#52)