fabric 4.5.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -0
- package/CONTRIBUTING.md +14 -0
- package/HEADER.js +1 -1
- package/README.md +3 -6
- package/SECURITY.md +5 -0
- package/build.js +1 -0
- package/dist/fabric.js +1160 -668
- package/dist/fabric.min.js +1 -1
- package/lib/event.js +7 -3
- package/package.json +11 -5
- package/publish-next.js +15 -0
- package/publish.js +3 -0
- package/src/brushes/base_brush.class.js +3 -5
- package/src/brushes/pattern_brush.class.js +7 -5
- package/src/brushes/pencil_brush.class.js +49 -37
- package/src/canvas.class.js +27 -57
- package/src/filters/saturate_filter.class.js +9 -1
- package/src/filters/vibrance_filter.class.js +122 -0
- package/src/mixins/animation.mixin.js +20 -25
- package/src/mixins/canvas_events.mixin.js +30 -59
- package/src/mixins/canvas_grouping.mixin.js +4 -4
- package/src/mixins/collection.mixin.js +11 -2
- package/src/mixins/eraser_brush.mixin.js +495 -452
- package/src/mixins/itext_behavior.mixin.js +7 -1
- package/src/mixins/itext_key_behavior.mixin.js +7 -1
- package/src/mixins/object_geometry.mixin.js +5 -35
- package/src/mixins/object_interactivity.mixin.js +18 -7
- package/src/mixins/object_straightening.mixin.js +4 -9
- package/src/mixins/observable.mixin.js +22 -0
- package/src/parser.js +13 -9
- package/src/shapes/circle.class.js +22 -19
- package/src/shapes/ellipse.class.js +2 -2
- package/src/shapes/group.class.js +24 -32
- package/src/shapes/image.class.js +3 -25
- package/src/shapes/itext.class.js +10 -0
- package/src/shapes/line.class.js +5 -21
- package/src/shapes/object.class.js +67 -32
- package/src/shapes/path.class.js +17 -18
- package/src/shapes/polygon.class.js +11 -10
- package/src/shapes/polyline.class.js +33 -24
- package/src/shapes/rect.class.js +0 -18
- package/src/shapes/text.class.js +120 -58
- package/src/shapes/triangle.class.js +0 -15
- package/src/static_canvas.class.js +43 -20
- package/src/util/animate.js +149 -16
- package/src/util/animate_color.js +2 -1
- package/src/util/lang_object.js +5 -1
- package/src/util/misc.js +193 -42
- package/src/util/path.js +89 -52
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
## [5.0.0]
|
|
5
|
+
|
|
6
|
+
- fix(fabric.Canvas): unflag contextLost after a full re-render [`#7646`](https://github.com/fabricjs/fabric.js/pull/7646)
|
|
7
|
+
- **BREAKING**: remove 4.x deprecated code [`#7630`](https://github.com/fabricjs/fabric.js/pull/7630)
|
|
8
|
+
- feat(fabric.StaticCanvas, fabric.Canvas): limit breaking changes [`#7627`](https://github.com/fabricjs/fabric.js/pull/7627)
|
|
9
|
+
- feat(animation): animations registry [`#7528`](https://github.com/fabricjs/fabric.js/pull/7528)
|
|
10
|
+
- docs(): Remove not working badges [`#7623`](https://github.com/fabricjs/fabric.js/pull/7623)
|
|
11
|
+
- ci(): add auto-changelog package to quickly draft a changelog [`#7615`](https://github.com/fabricjs/fabric.js/pull/7615)
|
|
12
|
+
- feat(fabric.EraserBrush): added `eraser` property to Object instead of attaching to `clipPath`, remove hacky `getClipPath`/`setClipPath` [#7470](https://github.com/fabricjs/fabric.js/pull/7470), see **BREAKING** comments.
|
|
13
|
+
- feat(fabric.EraserBrush): support `inverted` option to undo erasing [#7470](https://github.com/fabricjs/fabric.js/pull/7470)
|
|
14
|
+
- fix(fabric.EraserBrush): fix doubling opaic objects while erasing [#7445](https://github.com/fabricjs/fabric.js/issues/7445) [#7470](https://github.com/fabricjs/fabric.js/pull/7470)
|
|
15
|
+
- **BREAKING**: fabric.EraserBrush: The Eraser object is now a subclass of Group. This means that loading from JSON will break between versions.
|
|
16
|
+
Use this [code](https://gist.github.com/ShaMan123/6c5c4ca2cc720a2700848a2deb6addcd) to transform your json payload to the new version.
|
|
17
|
+
- feat(fabric.Canvas): fire an extra mouse up for the original control of the initial target [`#7612`](https://github.com/fabricjs/fabric.js/pull/7612)
|
|
18
|
+
- fix(fabric.Object) bounding box display with skewY when outside group [`#7611`](https://github.com/fabricjs/fabric.js/pull/7611)
|
|
19
|
+
- fix(fabric.text) fix rtl/ltr performance issues [`#7610`](https://github.com/fabricjs/fabric.js/pull/7610)
|
|
20
|
+
- fix(event.js) Prevent dividing by 0 in for touch gestures [`#7607`](https://github.com/fabricjs/fabric.js/pull/7607)
|
|
21
|
+
- feat(): `drop:before` event [`#7442`](https://github.com/fabricjs/fabric.js/pull/7442)
|
|
22
|
+
- ci(): Add codeql analysis step [`#7588`](https://github.com/fabricjs/fabric.js/pull/7588)
|
|
23
|
+
- security(): update onchange to solve security issue [`#7591`](https://github.com/fabricjs/fabric.js/pull/7591)
|
|
24
|
+
- **BREAKING**: fix(): MAJOR prevent render canvas with quality less than 100% [`#7537`](https://github.com/fabricjs/fabric.js/pull/7537)
|
|
25
|
+
- docs(): fix broken link [`#7579`](https://github.com/fabricjs/fabric.js/pull/7579)
|
|
26
|
+
- **BREAKING**: Deps(): MAJOR update to jsdom 19 node 14 [`#7587`](https://github.com/fabricjs/fabric.js/pull/7587)
|
|
27
|
+
- Fix(): JSDOM transative vulnerability [`#7510`](https://github.com/fabricjs/fabric.js/pull/7510)
|
|
28
|
+
- fix(fabric.parser): attempt to resolve some issues with regexp [`#7520`](https://github.com/fabricjs/fabric.js/pull/7520)
|
|
29
|
+
- fix(fabric.IText) fix for possible error on copy paste [`#7526`](https://github.com/fabricjs/fabric.js/pull/7526)
|
|
30
|
+
- fix(fabric.Path): Path Distance Measurement Inconsistency [`#7511`](https://github.com/fabricjs/fabric.js/pull/7511)
|
|
31
|
+
- Fix(fabric.Text): Avoid reiterating measurements when width is 0 and measure also empty lines for consistency. [`#7497`](https://github.com/fabricjs/fabric.js/pull/7497)
|
|
32
|
+
- fix(fabric.Object): stroke bounding box [`#7478`](https://github.com/fabricjs/fabric.js/pull/7478)
|
|
33
|
+
- fix(fabric.StaticCanvas): error of changing read-only style field [`#7462`](https://github.com/fabricjs/fabric.js/pull/7462)
|
|
34
|
+
- fix(fabric.Path): setting `path` during runtime [`#7141`](https://github.com/fabricjs/fabric.js/pull/7141)
|
|
35
|
+
- chore() update canvas to 2.8.0 [`#7415`](https://github.com/fabricjs/fabric.js/pull/7415)
|
|
36
|
+
- fix(fabric.Group) realizeTransfrom should be working when called with NO parent transform [`#7413`](https://github.com/fabricjs/fabric.js/pull/7413)
|
|
37
|
+
- fix(fabric.Object) Fix control flip and control box [`#7412`](https://github.com/fabricjs/fabric.js/pull/7412)
|
|
38
|
+
- feat(fabric.Text): added pathAlign property for text on path [`#7362`](https://github.com/fabricjs/fabric.js/pull/7362)
|
|
39
|
+
- docs(): Create SECURITY.md [`#7405`](https://github.com/fabricjs/fabric.js/pull/7405)
|
|
40
|
+
- docs(): Clarify viewport transformations doc [`#7401`](https://github.com/fabricjs/fabric.js/pull/7401)
|
|
41
|
+
- docs(): specify default value and docs for enablePointerEvents [`#7386`](https://github.com/fabricjs/fabric.js/pull/7386)
|
|
42
|
+
- feat(fabric.PencilBrush): add an option to draw a straight line while pressing a key [`#7034`](https://github.com/fabricjs/fabric.js/pull/7034)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## [4.6.0]
|
|
46
|
+
|
|
47
|
+
- feat(fabric.util): added fabric.util.transformPath to add transformations to path points [#7300](https://github.com/fabricjs/fabric.js/pull/7300)
|
|
48
|
+
- feat(fabric.util): added fabric.util.joinPath, the opposite of fabric.util.parsePath [#7300](https://github.com/fabricjs/fabric.js/pull/7300)
|
|
49
|
+
- fix(fabric.util): use integers iterators [#7233](https://github.com/fabricjs/fabric.js/pull/7233)
|
|
50
|
+
- feat(fabric.Text) add path rendering to text on path [#7328](https://github.com/fabricjs/fabric.js/pull/7328)
|
|
51
|
+
- feat(fabric.iText): Add optional hiddenTextareaContainer to contain hiddenTextarea [#7314](https://github.com/fabricjs/fabric.js/pull/7314)
|
|
52
|
+
- fix(fabric.Text) added pathStartOffset and pathSide to props lists for object export [#7318](https://github.com/fabricjs/fabric.js/pull/7318)
|
|
53
|
+
- feat(animate): add imperative abort option for animations [#7275](https://github.com/fabricjs/fabric.js/pull/7275)
|
|
54
|
+
- fix(Fabric.text): account for fontSize in textpath cache dimensions ( to avoid clipping ) [#7298](https://github.com/fabricjs/fabric.js/pull/7298)
|
|
55
|
+
- feat(Observable.once): Add once event handler [#7317](https://github.com/fabricjs/fabric.js/pull/7317)
|
|
56
|
+
- feat(fabric.Object): Improve drawing of controls in group. [#7119](https://github.com/fabricjs/fabric.js/pull/7119)
|
|
57
|
+
- fix(EraserBrush): intersectsWithObject edge cases [#7290](https://github.com/fabricjs/fabric.js/pull/7290)
|
|
58
|
+
- fix(EraserBrush): dump canvas bg/overlay color support [#7289](https://github.com/fabricjs/fabric.js/pull/7289)
|
|
59
|
+
- feat(fabric.Text) added pathSide property to text on path [#7259](https://github.com/fabricjs/fabric.js/pull/7259)
|
|
60
|
+
- fix(EraserBrush) force fill value [#7269](https://github.com/fabricjs/fabric.js/pull/7269)
|
|
61
|
+
- fix(fabric.StaticCanvas) properly remove objects on canvas.clear [#6937](https://github.com/fabricjs/fabric.js/pull/6937)
|
|
62
|
+
- feat(fabric.EraserBrush): improved erasing:end event [#7258](https://github.com/fabricjs/fabric.js/pull/7258)
|
|
63
|
+
- fix(shapes): fabric.Object._fromObject never should return [#7201](https://github.com/fabricjs/fabric.js/pull/7201)
|
|
64
|
+
- feat(fabric.filters) Added vibrance filter (for increasing saturation of muted colors) [#7189](https://github.com/fabricjs/fabric.js/pull/7189)
|
|
65
|
+
- fix(fabric.StaticCanvas): restore canvas size when disposing [#7181](https://github.com/fabricjs/fabric.js/pull/7181)
|
|
66
|
+
- feat(fabric.util): added `convertPointsToSVGPath` that will convert from a list of points to a smooth curve. [#7140](https://github.com/fabricjs/fabric.js/pull/7140)
|
|
67
|
+
- fix(fabric.Object): fix cache invalidation issue when objects are rotating [#7183](https://github.com/fabricjs/fabric.js/pull/7183)
|
|
68
|
+
- fix(fabric.Canvas): rectangle selection works with changing viewport [#7088](https://github.com/fabricjs/fabric.js/pull/7088)
|
|
69
|
+
- feat(fabric.Text): textPath now support textAlign [#7156](https://github.com/fabricjs/fabric.js/pull/7156)
|
|
70
|
+
- fix(fabric.EraserBrush): test eraser intersection with objects taking into account canvas viewport transform [#7147](https://github.com/fabricjs/fabric.js/pull/7147)
|
|
71
|
+
- fix(fabric.Object): support `excludeFromExport` set on `clipPath` [#7148](https://github.com/fabricjs/fabric.js/pull/7148).
|
|
72
|
+
- fix(fabric.Group): support `excludeFromExport` set on objects [#7148](https://github.com/fabricjs/fabric.js/pull/7148).
|
|
73
|
+
- fix(fabric.StaticCanvas): support `excludeFromExport` set on `backgroundColor`, `overlayColor`, `clipPath` [#7148](https://github.com/fabricjs/fabric.js/pull/7148).
|
|
74
|
+
- fix(fabric.EraserBrush): support object resizing (needed for eraser) [#7100](https://github.com/fabricjs/fabric.js/pull/7100).
|
|
75
|
+
- fix(fabric.EraserBrush): support canvas resizing (overlay/background drawables) [#7100](https://github.com/fabricjs/fabric.js/pull/7100).
|
|
76
|
+
- fix(fabric.EraserBrush): propagate `clipPath` of group to erased objects when necessary so it is correct when ungrouping/removing from group [#7100](https://github.com/fabricjs/fabric.js/pull/7100).
|
|
77
|
+
- fix(fabric.EraserBrush): introduce `erasable = deep` option for `fabric.Group` [#7100](https://github.com/fabricjs/fabric.js/pull/7100).
|
|
78
|
+
- feat(fabric.Collection): the `contains` method now accepts a second boolean parameter `deep`, checking all descendants, `collection.contains(obj, true)` [#7139](https://github.com/fabricjs/fabric.js/pull/7139).
|
|
79
|
+
- fix(fabric.StaticCanvas): disposing canvas now restores canvas size and style to original state.
|
|
80
|
+
|
|
3
81
|
## [4.5.1]
|
|
4
82
|
|
|
5
83
|
- fix(fabric.Text): fixes decoration rendering when there is a single rendering for full text line [#7104](https://github.com/fabricjs/fabric.js/pull/7104)
|
package/CONTRIBUTING.md
CHANGED
|
@@ -46,6 +46,20 @@ Contribute to fabricjs using a fully featured online development environment tha
|
|
|
46
46
|
|
|
47
47
|
[](https://gitpod.io/from-referrer/)
|
|
48
48
|
|
|
49
|
+
### Setting up a local environment
|
|
50
|
+
|
|
51
|
+
Coming Soon!
|
|
52
|
+
|
|
53
|
+
### Working on fabricjs.com
|
|
54
|
+
|
|
55
|
+
To develop fabric's site you need to clone [`fabricjs.com`](https://github.com/fabricjs/fabricjs.com) in the same parent folder of [`fabric.js`](https://github.com/fabricjs/fabric.js), so that `fabric.js` and `fabricjs.com` are siblings.
|
|
56
|
+
To start the dev server run `npm start` inside the `fabricjs.com` directory (after installing dependecies).
|
|
57
|
+
If you are working on windows, check out [`jekyll` docs](https://jekyllrb.com/docs/installation/) for futher instructions.
|
|
58
|
+
|
|
59
|
+
**Adding a DEMO**:
|
|
60
|
+
Take a look at an existing [demo file](https://github.com/fabricjs/fabricjs.com/blob/gh-pages/posts/demos/_posts/2020-2-15-custom-control-render.md).
|
|
61
|
+
Create a new file in the same directory (`posts/demos/_posts`) and you're good to go.
|
|
62
|
+
|
|
49
63
|
### Pull request guidelines
|
|
50
64
|
|
|
51
65
|
Here are a few notes you should take into account:
|
package/HEADER.js
CHANGED
package/README.md
CHANGED
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
[](https://www.npmjs.org/package/fabric)
|
|
15
15
|
[](https://cdnjs.com/libraries/fabric.js)
|
|
16
16
|
|
|
17
|
-
<!-- deps status -->
|
|
18
|
-
|
|
19
|
-
[](https://david-dm.org/kangax/fabric.js)
|
|
20
|
-
[](https://david-dm.org/kangax/fabric.js#info=devDependencies)
|
|
21
|
-
|
|
22
17
|
<!-- bounties, tips -->
|
|
23
18
|
|
|
24
19
|
[](https://www.bountysource.com/trackers/23217-fabric-js?utm_source=23217&utm_medium=shield&utm_campaign=TRACKER_BADGE)
|
|
@@ -56,7 +51,7 @@ Fabric.js allows you to easily create simple shapes like rectangles, circles, tr
|
|
|
56
51
|
- Opera 9.64+
|
|
57
52
|
- Chrome (all versions)
|
|
58
53
|
- Edge (chromium based, all versions)
|
|
59
|
-
- IE11 and Edge legacy, supported but
|
|
54
|
+
- IE11 and Edge legacy, not supported. Fabric up to 5.0 is written with ES5 in mind, but no specific tests are run for those browsers.
|
|
60
55
|
|
|
61
56
|
You can [run automated unit tests](http://fabricjs.com/test/unit/) right in the browser.
|
|
62
57
|
|
|
@@ -201,6 +196,7 @@ These are the optional modules that could be specified for inclusion, when build
|
|
|
201
196
|
- **easing** — Adds support for animation easing functions
|
|
202
197
|
- **node** — Adds support for running fabric under node.js, with help of [jsdom](https://github.com/tmpvar/jsdom) and [node-canvas](https://github.com/learnboost/node-canvas) libraries.
|
|
203
198
|
- **freedrawing** — Adds support for free drawing
|
|
199
|
+
- **erasing** — Adds support for object erasing using an eraser brush
|
|
204
200
|
- **gestures** — Adds support for multitouch gestures with help of [Event.js](https://github.com/mudcube/Event.js)
|
|
205
201
|
- **object_straightening** — Adds support for rotating an object to one of 0, 90, 180, 270, etc. depending on which is angle is closer.
|
|
206
202
|
- **animation** — Adds support for animation (`fabric.util.animate`, `fabric.util.requestAnimFrame`, `fabric.Object#animate`, `fabric.Canvas#fxCenterObjectH/#fxCenterObjectV/#fxRemove`)
|
|
@@ -250,6 +246,7 @@ For example:
|
|
|
250
246
|
|
|
251
247
|
- [Fabric on Bountysource](https://www.bountysource.com/trackers/23217-fabric-js)
|
|
252
248
|
- [Fabric on CodeTriage](http://www.codetriage.com/kangax/fabric.js)
|
|
249
|
+
- [Contributing](./CONTRIBUTING.md)
|
|
253
250
|
|
|
254
251
|
### Staying in touch
|
|
255
252
|
|
package/SECURITY.md
ADDED
package/build.js
CHANGED
|
@@ -216,6 +216,7 @@ var filesToInclude = [
|
|
|
216
216
|
ifSpecifiedInclude('image_filters', 'src/filters/resize_filter.class.js'),
|
|
217
217
|
ifSpecifiedInclude('image_filters', 'src/filters/contrast_filter.class.js'),
|
|
218
218
|
ifSpecifiedInclude('image_filters', 'src/filters/saturate_filter.class.js'),
|
|
219
|
+
ifSpecifiedInclude('image_filters', 'src/filters/vibrance_filter.class.js'),
|
|
219
220
|
ifSpecifiedInclude('image_filters', 'src/filters/blur_filter.class.js'),
|
|
220
221
|
ifSpecifiedInclude('image_filters', 'src/filters/gamma_filter.class.js'),
|
|
221
222
|
ifSpecifiedInclude('image_filters', 'src/filters/composed_filter.class.js'),
|