# Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser

### Related tags

Data Visualization fabric.js

## Fabric.js

Fabric.js is a framework that makes it easy to work with HTML5 canvas element. It is an interactive object model on top of canvas element. It is also an SVG-to-canvas parser.

Using Fabric.js, you can create and populate objects on canvas; objects like simple geometrical shapes — rectangles, circles, ellipses, polygons, or more complex shapes consisting of hundreds or thousands of simple paths. You can then scale, move, and rotate these objects with the mouse; modify their properties — color, transparency, z-index, etc. You can also manipulate these objects altogether — grouping them with a simple mouse selection.

### Non-Technical Introduction to Fabric

Fabric.js allows you to easily create simple shapes like rectangles, circles, triangles and other polygons or more complex shapes made up of many paths, onto the HTML <canvas> element on a webpage using JavaScript. Fabric.js will then allow you to manipulate the size, position and rotation of these objects with a mouse. It’s also possible to change some of the attributes of these objects such as their color, transparency, depth position on the webpage or selecting groups of these objects using the Fabric.js library. Fabric.js will also allow you to convert an SVG image into JavaScript data that can be used for putting it onto the <canvas> element.

Contributions are very much welcome!

### Supported browsers

• Firefox 4+
• Safari 5+
• Opera 9.64+
• Chrome (all versions)
• Edge (chromium based, all versions)
• IE11 and Edge legacy, supported but deprecated.

You can run automated unit tests right in the browser.

### History

Fabric.js started as a foundation for design editor on printio.ru — interactive online store with ability to create your own designs. The idea was to create Javascript-based editor, which would make it easy to manipulate vector shapes and images on T-Shirts. Since performance was one of the most critical requirements, we chose canvas over SVG. While SVG is excellent with static shapes, it's not as performant as canvas when it comes to dynamic manipulation of objects (movement, scaling, rotation, etc.). Fabric.js was heavily inspired by Ernest Delgado's canvas experiment. In fact, code from Ernest's experiment was the foundation of an entire framework. Later, Fabric.js grew into a collection of distinct object types and got an SVG-to-canvas parser.

$bower install fabric  ### Install with npm Note: If you are using Fabric.js in a Node.js script, you will depend from node-canvas.node-canvas is an html canvas replacement that works on top of native libraries. Please follow the instructions located here in order to get it up and running. $ npm install fabric --save


After this, you can import fabric like so:

const fabric = require("fabric").fabric;


Or you can use this instead if your build pipeline supports ES6 imports:

import { fabric } from "fabric";


NOTE: es6 imports won't work in browser or with bundlers which expect es6 module like vite. Use commonjs syntax instead.

See the example section for usage examples.

### Building

1. Install Node.js

2. Build distribution file [~77K minified, ~20K gzipped]

 $node build.js  2.1 Or build a custom distribution file, by passing (comma separated) module names to be included. $ node build.js modules=text,serialization,parser
// or
$node build.js modules=text // or$ node build.js modules=parser,text
// etc.


By default (when none of the modules are specified) only basic functionality is included. See the list of modules below for more information on each one of them. Note that default distribution has support for static canvases only.

To get minimal distribution with interactivity, make sure to include corresponding module:

   $node build.js modules=interaction  2.2 You can also include all modules like so: $ node build.js modules=ALL


2.3 You can exclude a few modules like so:

   $node build.js modules=ALL exclude=gestures,image_filters  3. Create a minified distribution file  # Using YUICompressor (default option)$ node build.js modules=... minifier=yui

$node build.js modules=... minifier=closure  4. Enable AMD support via require.js (requires uglify) $ node build.js requirejs modules=...

5. Create source map file for better productive debugging (requires uglify or google closure compiler).

 $node build.js sourcemap modules=...  If you use google closure compiler you have to add sourceMappingURL manually at the end of the minified file all.min.js (see issue https://code.google.com/p/closure-compiler/issues/detail?id=941).  //# sourceMappingURL=fabric.min.js.map  6. Ensure code guidelines are met (prerequisite: npm -g install eslint) $ npm run lint && npm run lint_tests


### Testing

1. Install Node.js

2. Install NPM, if necessary

3. Install NPM packages

 $npm install  4. Run test suite Make sure testem is installed $ npm install -g testem


Run tests Chrome and Node (by default):

    testem  See testem docs for more info: https://github.com/testem/testem ### Demos Who's using Fabric? ### Documentation Documentation is always available at http://fabricjs.com/docs/. Also see official 4-part intro series, presentation from BK.js and presentation from Falsy Values for an overview of fabric.js, how it works, and its features. ### Optional modules These are the optional modules that could be specified for inclusion, when building custom version of fabric: • text — Adds support for static text (fabric.Text) • itext — Adds support for interactive text (fabric.IText, fabric.Textbox) • serialization — Adds support for loadFromJSON, loadFromDatalessJSON, and clone methods on fabric.Canvas • interaction — Adds support for interactive features of fabric — selecting/transforming objects/groups via mouse/touch devices. • parser — Adds support for fabric.parseSVGDocument, fabric.loadSVGFromURL, and fabric.loadSVGFromString • image_filters — Adds support for image filters, such as grayscale of white removal. • easing — Adds support for animation easing functions • node — Adds support for running fabric under node.js, with help of jsdom and node-canvas libraries. • freedrawing — Adds support for free drawing • gestures — Adds support for multitouch gestures with help of Event.js • object_straightening — Adds support for rotating an object to one of 0, 90, 180, 270, etc. depending on which is angle is closer. • animation — Adds support for animation (fabric.util.animate, fabric.util.requestAnimFrame, fabric.Object#animate, fabric.Canvas#fxCenterObjectH/#fxCenterObjectV/#fxRemove) Additional flags for build script are: • requirejs — Makes fabric requirejs AMD-compatible in dist/fabric.js. Note: an unminified, requirejs-compatible version is always created in dist/fabric.require.js • no-strict — Strips "use strict" directives from source • no-svg-export — Removes svg exporting functionality • sourcemap - Generates a sourceMap file and adds the sourceMappingURL (only if uglifyjs is used) to dist/fabric.min.js For example: node build.js modules=ALL exclude=json no-strict no-svg-export  ### Examples of use #### Adding red rectangle to canvas <!DOCTYPE html> <html> <head> </head> <body> <canvas id="canvas" width="300" height="300"></canvas> <script src="lib/fabric.js"></script> <script> var canvas = new fabric.Canvas('canvas'); var rect = new fabric.Rect({ top : 100, left : 100, width : 60, height : 70, fill : 'red' }); canvas.add(rect); </script> </body> </html> ### Helping Fabric ### Staying in touch Follow @fabric.js, @kangax or @AndreaBogazzi on twitter. Questions, suggestions — fabric.js on Google Groups. See Fabric questions on Stackoverflow, Fabric snippets on jsfiddle or codepen.io. Fabric on LibKnot. Get help in Fabric's IRC channel — irc://irc.freenode.net/#fabric.js ### Credits ### MIT License Copyright (c) 2008-2015 Printio (Juriy Zaytsev, Maxim Chernyak) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ##### Comments • #### A Textbox with text wrapping and box resizing (subclasses IText) For Issue 187. This is a more fully featured implementation than Pull Request 725. I need this feature for my product, so I fully intend to support this class if it is made official. ### Demo Check it out a demo. ### Summary of features • Subclasses IText, so gets all of its goodness. • Text wraps as user types and/or resizes a Textbox. Works with all textAlign values. • User can change width of Textbox. Height is automatically set based on text wrapping. Font size and scale does not change. • Support for resizing in Groups. Only the width of a Textbox changes. The Textbox updates its scaleX/Y values to undo scale values of its parent Group so that font size remains the same. • Refactored the ton of this.text.split(this._reNewline) calls into a function that gets overwritten by subclasses. • Fixed bug in Justify text (was present in both Text and IText classes). • Tested on latest versions of Safari (OSX & iOS), Chrome (OSX & Win), Firefox and Internet Explorer. ### Open issues / TODOs 1. Need to add support for Styles. It is not required for my usage of this widget so contributions are welcome. 2. ~~Justify alignment needs to be fixed in IText.~~ 3. ~~Inheritance bug in IText.toSVG(). The callSuper in _setSVGTextLineText goes into a recursive loop if called on a Textbox object. It works fine if I replace the callSuper call with a call to a copy of Text._setSVGTextLineText. Have you encountered something like this before? Any opinions on how to fix this?~~ Please list changes that you'd like me to make before this can be made official. I saw in the other pull request that @kangax wasn't too sure about the 'Textbox' name ... we can change it. opened by jafferhaider 160 • #### Curve Text Feature [200]

Hi

Loving the product but we desperatly need curve text. I've seen that it's on the roadmap but would like to ask if there is any progress or anything that can be done to help?

Great work guys!

There is a $200 open bounty on this issue. Add to the bounty at Bountysource. feature bounty opened by dean555 119 • #### Site redesign [$305]

I wasn't sure if a site redesign is still on the table — it is mentioned here: https://github.com/kangax/fabric.js/wiki/Love-Fabric%3F-Help-us-by... — but I started to put something together that simplifies the homepage and encourages people to start with the tutorial or downloading the library.

I think simplifying the features that are showcases on the home page, as users can easily click through to the full demos page.

There are still some items that need to be added back in (twitter, github, flattr, etc.), but it is a start. If this is an acceptable first stab I will do some additional identity exploration and work to refine the design.

There is a $305 open bounty on this issue. Add to the bounty at Bountysource. feature bounty opened by aleph1 112 • #### Global canvas zooming [$1,091 awarded]

Posibility to zoom canvas (+/-) and all it's objects.

Here are some ideas from @kangax:

1. Programmatic canvas zooming One zoom level property (1 by default = normal zoom)
2. UI for canvas zooming UI is a secondary thing; we can do it after implementing programmatic zooming. For this, we'll probably need to introduce another canvas mode, similar to free drawing mode. When in that mode, canvas would zoom on click or dblclick or whatever. You wouldn't be able to select objects (similar to free drawing mode).

I like how zoom works in google docs. I think we should base off of that.

Other ideas:

• Touch device compatibility: Zoom in/out with touch

The 1,091 bounty on this issue has been claimed at Bountysource. feature bounty opened by Kienz 105 • #### feat(IText): Draggable text ### General Adds support for native like text dragging! Out of the box! This PR aims to support text dragging, making fabric's text objects feel/behave like a HTML textarea. It is an expected interaction from the user's point of view. closes #7800 ### Changes • drag/drop event logic on canvas/text: • firing DnD events with more data for the dev • addressed an issue with firing order on drag over targets and the selected target • onDragStart and canDrop are public methods for overriding that control drag and drop respectively • dragStart logic cycle - imitates spec, invokes target's onDragStart method, if result is true drag starts. Behaves like onSelect. • creating a drag image from onDragStart • dragEnd calls _onMouseUp synthetically - the browser doesn't do it and fabric needs it to finalize interaction logic • cursor/selection rendering on text - in order to render text selection on the drag source while dragging and the cursor on the drop target while dragging over it (same as what the browser does) ### Thoughts I think we ought to change the selectWord method to align with the behavior of html textarea which selects the word and all the trailing whitespace (it's important for drag and drop). ### TO DO • [x] perhaps wait for #7842 for DragEvent.dataTransfer • [ ] retina scaling for drag image - couldn't manage to fix the blur (will be handled in a follow up if ever) • [x] #7904 text opened by ShaMan123 93 • #### fix(polyline): stroke bounding rect calculation # Related Issues • https://github.com/fabricjs/fabric.js/issues/8025 • https://github.com/fabricjs/fabric.js/issues/7847 • #7478 # Proposed changes • ~~Created acos function in fabric.util to ensure the value is in the range [-1, 1] and the calcAngleBetweenVectors function is using it. This was causing a bug (see comment on commit bc93beb)~~ • ~~In calcAngleBetweenVectors function, replaces Math.hypot(x, y) with Math.sqrt(x*x + y*y) to ensure equal results in both engines: Firefox and Chrome. (see comment on commit bc93beb)~~ • ~~In getBisector function, checks if ro is close to zero instead of being strictly equal.~~ • In calcAngleBetweenVectors function, calculate angle between two vector using atan2 instead of dot product. So eliminated the need to check the angle direction in getBisector function, • Changed the _setPositionDimensions function in the polyline class to adjust the width/height by the scale in case of uniform stroke. • Changed the projectStrokeOnPoints function to cover all stroke line join cases and also to uniform stroke. This function deserves further comment: In the case of open path, the stroke is rendered differently, so I calculated with the vectors orthogonal to the stroke. In the case of the bevel, they are the points formed by the orthogonal to the vertex In the case of the round, ~~if the angle is less than or equal to 90°,~~ the projection is calculated with two vectors parallel to the X and Y axes. ~~In the case of larger angles, it is calculated using the orthogonals.~~ In the case of the miter, is the same calculation commented here: https://github.com/fabricjs/fabric.js/issues/8025 For a better view, see this link (you can change the vectors direction by holding the red circles) : https://hypertolosana.github.io/efficient-webgl-stroking/index.html # Screenshots Working example here: https://codesandbox.io/s/project-stroke-points-with-context-to-trace-b8jc4j?file=/src/index.js The red dotted vector is the bisector returned by the getBisector function. The green dotted vector is in the opposite direction and is what is used to determine which side to plot the projections. The projections are the colored vectors, one color for each point. To make debugging easier, you can configure the parameters (stroke line join type, strokeUniform, miterLimit, etc..) ## openPath = false and strokeUniform = true | Angle | Miter | Round | Bevel | |----------|:-------------:|:-------------:|:-------------:| | less than 90° | | | | greater than 90° | | | | equal to 180° | | | | fix-next opened by luizzappa 83 • #### Resized images pixelated - option for better downsampling available? [300 awarded]

Regarding https://groups.google.com/forum/?hl=en#!topic/fabricjs/N5LOujX-qMA it would be great to have an option for better resampling when scaling images with fabric:

It looks like fabric.js currently uses only the browser's native/default (bilinear?) resampling capabilities, which usually result in very pixelated, low-quality images when scaling down.

I would like to request a feature that avoids pixelation and resamples images to a higher quality especially when scaling down (similar to http://jsfiddle.net/qwDDP/), e.g. when the user uses the scaling handles on an image element in a fabric.js canvas, or when the scaleX/Y or width/height properties are used.

Depending on performance impact, this could happen during scaling, or when scaling has completed, but should yield a high quality scaled image in any case.

Addendum: As far as text resampling suffers the same issue (which it may not), it would be ideal if that was addressed as well.

# TO DO

• [x] Bring here all the documentation that is in the PR https://github.com/fabricjs/fabric.js/pull/8083/
• [x] Handle the case when skewX and skewY are applied at the same time when stroke line join is round (still buggy)
• [x] Handle open path with strokeLinecap equals round and square
• [x] Check if in the _set function when skew is applied, I need to invoke dimensioning for all line type joins
• [x] Adjust http://fabricjs.com/custom-controls-polygon to work correctly with skew (another PR) https://github.com/fabricjs/fabric.js/pull/8556
• [x] handle 1 point edge case: round projection?
opened by luizzappa 78
• #### Add support for static width/height of fabric.Text (text wrap)

Currently resizing a text element simple scales the text. This shouldn't be the case, instead resizing should re-define the bounding box around the text.

You should also be able to change the behaviour of text overflow. This should be defined with a new (set|get)textOverflow property. Similar to the text-overflow CSS3 attribute. see: https://developer.mozilla.org/en/CSS/text-overflow

Similarly wrapping behaviour should be defined by the use of a new (set|get)wordWrap property. Similar to the CSS3 word-wrap attribute. See: https://developer.mozilla.org/en/CSS/word-wrap

Having it this way also then makes more sense for the textAlign properties. Text alignment should then be relative to the bounding box. Not the whole canvas! I'm not sure how you use these at the moment, but it's confusing none the less.

I know re-writing the text element to remove cufon dependency is high on the Todo list, so when you start doing that if you could include the above changes I'd really appreciate it. Also looking forward to removing cufon, being able to use any css font will be so much better.

I'd be happy to help contribute but I have no idea how far through the rewrite you already are. Please advise when/where you'd need help doing this.

Thanks

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

possible_feature
opened by ollym 76
• #### Text on paths

@melchiar This PR contains the progress of text on a path, that i started right now. i ll push up every time i do a small progress.

closes #729 closes #5900 closes #2544

feature
opened by asturur 69
• #### text rendering changes

This is the more updated code.

closes #1814, #1897, #1905, #1581, #1940 Current situation: Current iText Drawing, showing BackGroundColor, TextBackgroundColor, selection behaviour

desired behaviour ( more or less )

As of now this code changes the behaviour in this way: normal text:

itext:

opened by asturur 69

## Motivation

There is an edge case where while using context top (free drawing) and a render occurs text instances render and clear their bbox from context top. They shouldn't Take a look at the video ending in a mouse up.

https://user-images.githubusercontent.com/34343793/210237649-65b58d80-6bb1-40fe-a562-82315656e0e1.mp4

## Description

clearContextTop suffers from a built in problem. It clears the context with the known width/height values. Efforts were made to overcome that (quite a lot it seems) and most of cases (distinct case no. 1, see below) were indeed fixed but not all (e.g. transforming). It did cause a need to track every case and clear the context before the change propagates to the instance, which is folly. More interaction, more cases, a mess.

There are 2 distinct cases in which we should consider how to act:

1. changing selection only (which is not part of the rendering cycle due to perf, imperative in sight of context state)
2. changing visuals (part of rendering, declarative in sight of context state)

Seems that efforts were focused on clearing context for the first case but the second case was neglected (rendering, transforming and many others). It can be understood since the first case was/is the main dev effort for making itext work. The second case is an integration thing, app level.

## Changes

removed clearing context top:

• vpt change
• size change: initDimensions

## Gist

The render method calls renderCursorOrSelection that runs only if in editing mode. If executed it marks top context as dirty for the canvas rendering cycle.

Looking at what brush does and applying it to itext: If the entire canvas is rendered it is 100% proof since the top context will be cleared by the canvas and then selection will be drawn by the instance that is being edited. If we mess with the context w/o rendering canvas to handle selection as we do with key/input events then we must clear context top as part of logic and we must take into account any changes to size of instance and we should mark top context as dirty as well. So the rule of thumb should be if we mess with selection alone then we call clearContextTop.

initDimensions is a good example for the confusion around this. The context was cleared before changes to size were committed to avoid leaving traces, but even though it was not 100% proof. Since canvas must be rendered in order for the new size to be visible it is a pure no. 2 distinct case so we can safely hook to the rendering cycle.

## In Action

text
opened by ShaMan123 10

## Motivation

This update seems to have no side effects on the build Just a reference branch to experiment with using exports

## In Action

opened by asturur 4

## Description

Custom poly controls as part of fabric.js core.

Fixes:

• Poly with skew
• Poly with flip
• Poly with strokeUniform

Closes: https://github.com/fabricjs/fabric.js/issues/8359

## Gist

  const poly = canvas.getActiveObject();
poly.controls = fabric.controlsUtils.PolyControl.createPolyControls(
poly.points.length,
{ cursorStyle: 'crosshair' } //pass custom options
);
canvas.requestRenderAll();


## In Action

~~https://codesandbox.io/s/custom-control-poly-95y2im~~

https://codesandbox.io/s/custom-control-poly-fix-flip-95y2im

opened by luizzappa 12

### CheckList

• [X] I agree to follow this project's Code of Conduct
• [X] I have read and followed the Contributing Guide
• [X] I have read and followed the Issue Tracker Guide
• [X] I have searched and referenced existing issues and discussions
• [X] I am filing a BUG report.
• [X] I have created an accurate and minimal reproduction

5.3.0

Chrome

### Node Version (if applicable)

14.19.3

https://jsfiddle.net/huylv177/62rwofk5/12/

### Steps To Reproduce

1. I use fabric.Image.fromURL(base64) to add image to canvas, but sometime its show empty page. I logged callback from fromURL function below:
• When website show empty canvas
• When website show correct image

### Expected Behavior

Show correct image

Show nothing

### Error Message & Stack Trace

No response

opened by huy-lv 0

## Motivation

I would like the animation code and interface to be simpler. So i m proposiing some simplificaiton, it makes also documenting animation easier.

## Description

Removal some flexibility in the api in exchange of some code semplification

i also create a folder parkinglot where i put the straighten code and i think i m putting the canvas effects too. Those needs to be changed in examples or something that the developer can grab, but i don't think they should be part of af the class itself. We have 4 effects, while the possibilities are so many that i think providing 4 of them and nothing else just makes noise.

Other things i would like to solve:

• keypath in animation. I don't have a solution right now but ideally i would like to list the cases in which a keypat is needed ( gradients i m sure and little else probably )
• duality between byValue and endValue, i would like to keep one only.

## Changes

• Object.animate takes only an object with one or more properties
• animate does not take += or -= anymore, we can write an addition or subtraction when we do the animation end value.
• removed barrel imports
• Object.animate does not undefine anymore the onChange and onComplete of multiple keys. Reasons are that with requestRenderAll that is not needed anymore, and since you can cancel a single animation, if you cancel the one that carry the actual callbacks the others are not working anymore. We need to be clear on the fact that you shoudn't do expensive things on onChange and that you should use requestRenderAll rather than renderAll.

## Some other proposals

### naming changes

export type TOnAnimationChangeCallback<T, R = void> = (
value: T,
valueRatio: number,
durationRatio: number
) => R;


into

export type TOnAnimationChangeCallback<T, R = void> = (
value: T,
valueProgress: number,
timeProgress: number
) => R;


Reason: ratio is generic, can be 3, 4, -3 0.5. We have values here that are always between 0 and 1 and represent the progress between start and end. I think this naming would be more clear.

## In Action

opened by asturur 9

## Motivation

We were looking for a mechanism to instruct TS that we are executing in a given state. We could use it for cached object etc.

## Description

Unfortunately it is impossible to combine an asserts directive with this is T. That would have been great.

## Gist

View the following code snippet in the TS playground



export type AssertKeys<T, K extends keyof T> = T & Record<K, NonNullable<T[K]>>;

export class CommonMethods {
/**
* use this internal method to assert state during execution
*/
protected assertThisType<K extends keyof this>(): asserts this is AssertKeys<
this,
K
> {
// noop, here only for TS
}
}

class Foo extends CommonMethods {
stateProp?: number;
method() {
return this.stateProp + 1;
}
assertsState() {
this.assertThisType<'stateProp'>();
return this.stateProp + 1;
}
}

Output
export class CommonMethods {
/**
* use this internal method to assert state during execution
*/
assertThisType() {
// noop, here only for TS
}
}
class Foo extends CommonMethods {
method() {
return this.stateProp + 1;
}
assertsState() {
this.assertThisType();
return this.stateProp + 1;
}
}


Compiler Options
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"alwaysStrict": true,
"esModuleInterop": true,
"declaration": true,
"experimentalDecorators": true,
"target": "ES2017",
"jsx": "react",
"module": "ESNext",
"moduleResolution": "node"
}
}


## In Action

opened by ShaMan123 2
• #### v5.3.1(Dec 20, 2022)

• fix(textStyles): Handle empty style object in stylesToArray (https://github.com/fabricjs/fabric.js/commit/1039a12c2632981774793bb7a973d3b0f2282f35) (backported from https://github.com/fabricjs/fabric.js/pull/8357)
• fix(util/misc.js): include textBackgroundColor in hasStyleChanged (https://github.com/fabricjs/fabric.js/commit/ab377538da61b343b520019bd0c804f67db9e4e5) (backported from https://github.com/fabricjs/fabric.js/pull/8365)
• feat(filters): Add a filtertype option when creating a texture #8528
Source code(tar.gz)
Source code(zip)
• #### v5.2.4(Aug 25, 2022)

fixed version

Full Changelog: https://github.com/fabricjs/fabric.js/compare/v521...v5.2.4

Fixed setStyle exception #7869

Fixed IText focus issue #8179

BREAKING: Text#toObject style property is changed from an object to an array at serialization #7842

Source code(tar.gz)
Source code(zip)

## What's Changed

• Version 5.2.1 by @asturur in https://github.com/fabricjs/fabric.js/pull/7725
• feat(Text): condensed styles structure by @melchiar in https://github.com/fabricjs/fabric.js/pull/7842
• fix(): toDataless object restore with a single object svg and with clipPath by @asturur in https://github.com/fabricjs/fabric.js/pull/8010
• fix(Text) backport fromObject mutation fixes by @melchiar in https://github.com/fabricjs/fabric.js/pull/8060

Full Changelog: https://github.com/fabricjs/fabric.js/compare/v521...v5.2.3

Source code(tar.gz)
Source code(zip)

• #### v520(Feb 21, 2022)

Source code(tar.gz)
Source code(zip)
• #### v510(Feb 16, 2022)

Source code(tar.gz)
Source code(zip)
• #### v500(Feb 5, 2022)

Detailed breaking changes available at: here

Source code(tar.gz)
Source code(zip)
• #### v460(Aug 27, 2021)

• feat(fabric.util): added fabric.util.joinPath, the opposite of fabric.util.parsePath #7300
• fix(fabric.util): use integers iterators #7233
• feat(fabric.Text) add path rendering to text on path #7328
• feat(fabric.iText): Add optional hiddenTextareaContainer to contain hiddenTextarea #7314
• fix(fabric.Text) added pathStartOffset and pathSide to props lists for object export #7318
• feat(animate): add imperative abort option for animations #7275
• fix(Fabric.text): account for fontSize in textpath cache dimensions ( to avoid clipping ) #7298
• feat(Observable.once): Add once event handler #7317
• feat(fabric.Object): Improve drawing of controls in group. #7119
• fix(EraserBrush): intersectsWithObject edge cases #7290
• fix(EraserBrush): dump canvas bg/overlay color support #7289
• feat(fabric.Text) added pathSide property to text on path #7259
• fix(EraserBrush) force fill value #7269
• fix(fabric.StaticCanvas) properly remove objects on canvas.clear #6937
• feat(fabric.EraserBrush): improved erasing:end event #7258
• fix(shapes): fabric.Object._fromObject never should return #7201
• feat(fabric.filters) Added vibrance filter (for increasing saturation of muted colors) #7189
• fix(fabric.StaticCanvas): restore canvas size when disposing #7181
• feat(fabric.util): added convertPointsToSVGPath that will convert from a list of points to a smooth curve. #7140
• fix(fabric.Object): fix cache invalidation issue when objects are rotating #7183
• fix(fabric.Canvas): rectangle selection works with changing viewport #7088
• feat(fabric.Text): textPath now support textAlign #7156
• fix(fabric.EraserBrush): test eraser intersection with objects taking into account canvas viewport transform #7147
• fix(fabric.Object): support excludeFromExport set on clipPath #7148.
• fix(fabric.Group): support excludeFromExport set on objects #7148.
• fix(fabric.StaticCanvas): support excludeFromExport set on backgroundColor, overlayColor, clipPath #7148.
• fix(fabric.EraserBrush): support object resizing (needed for eraser) #7100.
• fix(fabric.EraserBrush): support canvas resizing (overlay/background drawables) #7100.
• fix(fabric.EraserBrush): propagate clipPath of group to erased objects when necessary so it is correct when ungrouping/removing from group #7100.
• fix(fabric.EraserBrush): introduce erasable = deep option for fabric.Group #7100.
• feat(fabric.Collection): the contains method now accepts a second boolean parameter deep, checking all descendants, collection.contains(obj, true) #7139.
• fix(fabric.StaticCanvas): disposing canvas now restores canvas size and style to original state.
Source code(tar.gz)
Source code(zip)
• #### v451(Jun 20, 2021)

• fix(fabric.Text): fixes decoration rendering when there is a single rendering for full text line #7104
• fix(fabric.util): unwanted mutation in fabric.util.rotatePoint #7117
• fix(svg parser): Ensure that applyViewboxTransform returns an object and not undefined/null #7030
• fix(fabric.Text): support firefox with ctx.textAlign for RTL text #7126
Source code(tar.gz)
Source code(zip)
• #### v4.5.0(May 22, 2021)

• fix(fabric.PencilBrush) decimate deleting end of a freedrawing line #6966
• feat(fabric.Text): Adding support for RTL languages by adding direction property #7046
• feat(fabric) Add an eraser brush as optional module #6994
• fix v4: 'scaling' event triggered before object position is adjusted #6650
• Fix(fabric.Object): CircleControls transparentCorners styling #7015
• Fix(svg_import): svg parsing in case it uses empty use tag or use with image href #7044
• fix(fabric.Shadow): offsetX, offsetY and blur supports float #7019
Source code(tar.gz)
Source code(zip)
• #### v4.4.0(Apr 7, 2021)

• fix(fabric.Object) wrong variable name cornerStrokeColor #6981
• fix(fabric.Text): underline color with text style ( regression from text on a path) #6974
• fix(fabric.Image): Cache CropX and CropY cache properties #6924
• fix(fabric.Canvas): Add target to each selection event #6858
• fix(fabric.Image): fix wrong scaling value for the y axis in renderFill #6778
• fix(fabric.Canvas): set isMoving on real movement only #6856
• fix(fabric.Group) make addWithUpdate compatible with nested groups #6774
• fix(Fabric.Text): Add path to text export and import #6844
• fix(fabric.Canvas) Remove controls check in the pixel accuracy target #6798
• feat(fabric.Canvas): Added activeOn 'up/down' property #6807
• feat(fabric.BaseBrush): limitedToCanvasSize property to brush #6719
Source code(tar.gz)
Source code(zip)
• #### v4.3.1(Jan 27, 2021)

• fix(fabric.Control) implement targetHasOneFlip using shorthand #6823
• fix(fabric.Text) fix typo in cacheProperties preventing cache clear to work #6775
• fix(fabric.Canvas): Update backgroundImage and overlayImage coordinates on zoom change #6777
• fix(fabric.Object): add strokeuniform to object toObject output. #6772
• fix(fabric.Text): Improve path's angle detection for text on a path #6755
Source code(tar.gz)
Source code(zip)
• #### v4.3.0(Dec 23, 2020)

• fix(fabric.Textbox): Do not let splitbygrapheme split text previously unwrapped #6621
• feat(fabric.controlsUtils) Move drag to actions to control handlers #6617
• feat(fabric.Control): Add custom control size per control. #6562
• fix(svg_export): svg export in path with gradient and added tests #6654
• fix(fabric.Text): improve compatibility with transformed gradients #6669
• feat(fabric.Text): Add ability to put text on paths BETA #6543
• fix(fabric.Canvas): rotation handle should take origin into account #6686
• fix(fabric.Text): Text on path, fix non linear distance of chars over path #6671
Source code(tar.gz)
Source code(zip)
• #### v4.2.0(Sep 26, 2020)

• fix(fabric.utils): ISSUE-6566 Fix SVGs for special Arc lines #6571
• fix(fabric.Canvas): Fix mouse up target when different from action start #6591
• added: feat(fabric.controlsUtils): Fire resizing event for textbox width #6545
• added: feat(fabric.controlsUtils) Move drag to actions to control handlers #6617
Source code(tar.gz)
Source code(zip)
• #### v4.1.0(Aug 24, 2020)

• feat(Brushes): add beforePathCreated event #6492;
• feat(fabric.Path): Change the way path is parsed and drawn. simplify path at parsing time #6504;
• feat(fabric.Path): Simplify S and T command in C and Q. #6507;
• fix(fabric.Textbox): ISSUE-6518 Textbox and centering scaling #6524;
• fix(fabric.Text): Ensure the shortcut text render the passed argument and not the entire line #6526;
• feat(fabric.util): Add a function to work with path measurements #6525;
• fix(fabric.Image): rendering pixel outside canvas size #6326;
• fix(fabric.controlsUtils): stabilize scaleObject function #6540;
• fix(fabric.Object): when in groups or active groups, fix the ability to shift deselect #6541;
Source code(tar.gz)
Source code(zip)

• #### v3.6.4(Aug 23, 2020)

• fix(fabric.Image): fix safari drawing bug for using drawImage outside element boundaries #6326
• fix(fabric.Itext): fix copy paste of text with style #6418
• fix(fabric.Itext): carry over style of selected test when replacing by typing (cherry-pick) #6172
Source code(tar.gz)
Source code(zip)
• #### v4.0.0(Aug 6, 2020)

• fixed the gesture module to not break with 4.0 #6491;
• fix(fabric.IText): copy style in non full mode when typing text #6454;
• feat(fabric.Controls) expose the extra utils for control handling. Breaking: rename fabric.controlHandlers and fabric.controlRenderers to fabric.controlsUtils.
Source code(tar.gz)
Source code(zip)
• #### v4.0.0-rc.1(Jul 4, 2020)

fix(fabric.Canvas): ISSUE-6314 rerender in case of drag selection that select a single oobject. #6421; feat(text): allow correct cursor/selection position if text is edited inside a group. #6256; feat(fabric.Control): remove position option in favor of x and y #6415; fix(fabric.Object) ISSUE-6340 infinite recursion on groups #6416; fix(fabric.Object): geometry mixin fix partiallyOnscreen #6402; fix(fabric.Image): ISSUE-6397 modify crossOrigin behaviour for setSrc #6414; Breaking: fabric.Image.setCrossOrigin is gone. Having the property on the fabric.Image is misleading and brings to errors. crossOrigin is for loading/reloading only, and is mandatory to specify it each load. Breaking: fabric.Control constructor does not accept anymore a position object, but 2 properties, x and y.

Source code(tar.gz)
Source code(zip)

• #### v4.0.0-beta.11(Apr 25, 2020)

• fix(itext): improved style handling for new lines #6268
• fix(controls): Fix flip and controls and skewY and controls. #6278
• fix(controls): Current position with handlers is wrong if using skew #6267
• breaking: setCoords has only one argument now skipCorners boolean. setCoords will always update aCoords, lineCoords. If skipCorners is not specified, it will alos update oCoords();
• feat(fabric.Image): Image.imageSmoothing for fabric.Image objects #6280
• fix(fabric.StaticCanvas): export to dataUrl and canvasElement will respect imageSmoothingEnabled #6280
• fix(fabric.Image): toSVG export with missing element won't crash #6280
• added svg import/export for image image-rendering attribute
• fix(svg_import): Fix some parsing logic for nested SVGs. #6284
• fix(fabric.Image): do not crash if image has no element #6285
Source code(tar.gz)
Source code(zip)

## [4.0.0-beta.10]

• fix(controls): fix missing target in canvas event options #6251
• fix(controls): correct position for offsets #6250
• feat(utils): Added more error flag passing throughout functions #6238
Source code(tar.gz)
Source code(zip)
• #### v4.0.0-beta.9(Mar 28, 2020)

• fix(controls) show offsetX/offsetY correctly. #6236
• fix(controls) ISSUE-6201 Restore per object setting of controls visibility #6226
• fix(svg_parser): ISSUE-6220 Allow to parse font declaration that start with a number #6222
Source code(tar.gz)
Source code(zip)
• #### v4.0.0-beta.8(Mar 20, 2020)

• fix(IText) Stop composition events on mousedown to enable cursor position on android keyboards #6224
• fix(controls): Handle textbox width change properly #6219
• fix(controls): correctly handling the uniform scaling option #6218
• fix(fabric.Object): fix activeSelection toDataURL canvas restore #6216
• fix(svg_parsers): Add support for empty