FabricJS Articles

Page 14 of 51

How to enable centered scaling on a canvas using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 1K+ Views

In this article, we are going to learn how to enable centered scaling on a canvas using FabricJS. In FabricJS, an object gets transformed proportionally when dragged from the corners. We can use the centeredScaling property to use the center as the origin of transformation. Syntax new fabric.Canvas(element: HTMLElement|String, { centeredScaling: Boolean }: Object) Parameters element − This parameter is the element itself which can be derived using Document.getElementById() or the id of ...

Read More

How to add dashes to the border of a selection area on a canvas using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 530 Views

In this article, we are going to learn how to add dashes to the border of a selection area on a canvas using FabricJS. We can achieve this by using the selectionDashArray property. It allows us to make the border of a selection area dashed. Syntax new fabric.Canvas(element: HTMLElement|String, { selectionDashArray: Array }: Object) Parameters element − This parameter is the element itself which can be derived using document.getElementById() or the id of the element itself. The FabricJS canvas will be ...

Read More

How to enable selection of object only when it is fully contained in a selection area in FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 887 Views

In this article, we are going to learn how to enable the selection of an object only when it is fully contained in the selection area using FabricJS. We can use the selectionFullyContained property to achieve this. Syntax new fabric.Canvas(element: HTMLElement|String, { selectionFullyContained: Boolean }: Object) Parameters element − This parameter is the element itself which can be derived using Document.getElementById() or the id of the element itself. The FabricJS canvas will ...

Read More

How to set a custom key to enable/disable uniform scaling on a canvas in FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 609 Views

In this article, we are going to learn how to set a custom key to enable/disable uniform scaling in FabricJS. In FabricJS, an object gets transformed proportionally when dragged from its corners. This is called uniform scaling. However, we can enable/disable this behavior by using the uniScaleKey. Syntax new fabric.Canvas(element: HTMLElement|String, { uniScaleKey: String }: Object) Parameters element − This parameter is the element itself which can be derived using Document.getElementById() or the id of the element itself. The FabricJS canvas will be initialized on this element. options (optional) − This ...

Read More

How to customize the viewport of the canvas using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 2K+ Views

In this article, we are going to learn how to customize the viewport of the canvas using FabricJS. The viewport is the visible area of the canvas that users can see. We can customize the viewport using the viewportTransform property, which allows us to control transformations like scaling, translation, and skewing of the entire canvas view. What is viewportTransform? The viewportTransform property is a transformation matrix represented as an array of 6 values: [scaleX, skewY, skewX, scaleY, translateX, translateY]. This matrix transforms the entire canvas coordinate system, affecting how all objects are displayed. Syntax new ...

Read More

How to clone a canvas using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 2K+ Views

In this article, we are going to learn how to clone a canvas using FabricJS. We can clone a canvas instance by using the clone() method. Usually, this is useful when we want to send our canvas instance remotely to somewhere else, it is usually a good idea to send the canvas instance clone in JSON form instead of sending the image of the canvas. clone() method helps us create a clone of any canvas instance along with its objects. Syntax clone(callback: Function, propertiesToInclude: Array) Parameters ...

Read More

How to create a canvas with a crosshair cursor using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 518 Views

In this article, we are going to create a canvas with a crosshair cursor using FabricJS. Crosshair is one of the native cursor styles available, which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize, etc. which are reusing the native cursor under the hood. Each of these cursors look slightly different based on operating system. Syntax new fabric.Canvas(element: HTMLElement|String, { defaultCursor: String }: Object) Parameters element − This parameter is the ...

Read More

How to create a canvas with not-allowed cursor using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 260 Views

In this article, we are going to create a canvas with a not-allowed cursor using FabricJS. A not-allowed cursor can be used to indicate that any action that has been requested, will not be carried out. not-allowed is one of the native cursor styles available which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize etc. which are reusing the native cursor underhood. Each of these cursors look slightly different based on operating system. Syntax new fabric.Canvas(element: HTMLElement|String, { defaultCursor: String }: Object) ...

Read More

How to create a canvas with a wait cursor using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 253 Views

In this article, we are going to create a canvas with a wait cursor using FabricJS. A wait cursor can be used to indicate a busy program in the background which also stops the user from interacting with the interface. wait is one of the native cursor style available which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize, etc. that reuse the native cursor under the hood. Each of these cursors look slightly different based on operating system. Syntax new fabric.Canvas(element: HTMLElement|String, { defaultCursor: ...

Read More

How to create a canvas with a help cursor using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 569 Views

In this article, we are going to create a canvas with a help cursor using FabricJS. The question mark in a help pointer indicates that useful information for the user is present. It is also often accompanied by useful links and can be seen while using a new application. help is one of the native cursor style available which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize, etc., that reuse the native cursor under the hood. Each of these cursors look slightly different based on operating system. ...

Read More
Showing 131–140 of 506 articles
« Prev 1 12 13 14 15 16 51 Next »
Advertisements