Rahul Gurung

Rahul Gurung

490 Articles Published

Articles by Rahul Gurung

Page 30 of 49

How to set the vertical origin of transformation of IText using FabricJS?

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

In this tutorial, we are going to learn how to set the vertical origin of transformation of IText using FabricJS. The IText class was introduced in FabricJS version 1.4, extends fabric.Text and is used to create IText instances. An IText instance gives us the freedom to select, cut, paste or add new text without additional configurations. There are also various supported key combinations and mouse/touch combinations which make text interactive which are not provided in Text. Textbox, however, which is based on IText allows us to resize the text rectangle and wraps lines automatically. This is not true for ...

Read More

FabricJS – How to get the coordinates of a Line object as if it has a different origin?

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

In this tutorial, we are going to learn about how to get the coordinates of a Line as if it has a different origin using FabricJS. A Line element is one of the basic elements provided in FabricJS. It is used for creating straight lines. Because line elements are geometrically one-dimensional and do not contain an interior, they are never filled. We can create a line object by creating an instance of fabric.Line, specifying the x and y coordinates of the line and adding it to the canvas. In order to find the coordinates of a Line object as if ...

Read More

FabricJS – Finding the Transform Matrix that Represents the Current Transformations for a Polygon Object?

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

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to find the transform matrix which represents current transformations, we use the calcOwnMatrix method. Syntax calcOwnMatrix(): Array Understanding Transform Matrix The transform matrix is a 6-element array that represents all transformations applied to an object: [scaleX, skewY, skewX, ...

Read More

How to set the opacity of a Circle using FabricJS?

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

In this tutorial, we are going to learn how to set the opacity of Circle using FabricJS. Circle is one of the various shapes provided by FabricJS. In order to create a circle, we will create an instance of fabric.Circle class and add it to the canvas. We can customize a circle object by adding a fill colour to it, eliminate its borders or even make changes in its dimensions. Similarly, we can also change its opacity by using the opacity property. Syntax new fabric.Circle({ opacity: Number }) Parameters ...

Read More

FabricJS – How to move a Line object one step down in the stack of drawn objects?

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

In this tutorial, we are going to learn about how to move a Line object one step down in the stack of drawn objects using FabricJS. A Line element is one of the basic elements provided in FabricJS. It is used for creating straight lines. Because line elements are geometrically one-dimensional and do not contain an interior, they are never filled. We can create a line object by creating an instance of fabric.Line, specifying the x and y coordinates of the line and adding it to the canvas. In order to move a Line object one step down in the ...

Read More

FabricJS – How to check if a Polygon Object Intersects with Another Object?

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

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to check if a Polygon object intersects with another object, we use the intersectsWithObject method. This method checks whether the object that is passed to it, intersects with the polygon object. Syntax intersectsWithObject(other: Object, absolute: Boolean, calculate: Boolean ): Boolean ...

Read More

How to set the angle of skew on x-axis of Triangle using FabricJS?

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

In this tutorial, we are going to learn how to set the angle of skew on the x-axis of a Triangle using FabricJS. Triangle is one of the various shapes provided by FabricJS. In order to create a triangle, we will have to create an instance of fabric.Triangle class and add it to the canvas. Our triangle object can be customized in various ways like changing its dimensions, adding a background color or by changing the angle of skew on the x-axis. We can do this by using the skewX property. Syntax new fabric.Triangle({ skewX : ...

Read More

How to straighten an IText object using FabricJS?

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

In this tutorial, we are going to learn about how to straighten an IText object using FabricJS. The IText class was introduced in FabricJS version 1.4, extends fabric.Text and is used to create IText instances. An IText instance gives us the freedom to select, cut, paste or add new text without additional configurations. There are also various supported key combinations and mouse/touch combinations which make text interactive which are not provided in Text. Textbox, however, which is based on IText allows us to resize the text rectangle and wraps lines automatically. This is not true for IText as height ...

Read More

FabricJS – How to set the dash pattern of the controlling corners of a Line?

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

In this tutorial, we are going to learn about how to set the dash pattern of controlling corners of Line using FabricJS. A Line element is one of the basic elements provided in FabricJS. It is used for creating straight lines. Because line elements are geometrically one-dimensional and do not contain an interior, they are never filled. We can create a line object by creating an instance of fabric.Line, specifying the x and y coordinates of the line and adding it to the canvas. We can also specify a dash pattern for the controlling corners by using the cornerDashArray ...

Read More

How to disable selection of objects via dragging in a canvas using FabricJS?

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

In this article, we are going to illustrate how you can disable the selection of objects via dragging in FabricJS. In a FabricJS canvas, we can basically click anywhere and select an area and any object in that area will get selected. In this article, we will see how to disallow this behavior. Syntax new fabric.Canvas(element: HTMLElement|String, {selection: boolean}: Object) Parameters element − This parameter is the element itself which can be derived using document.getElementById() or the id of the element ...

Read More
Showing 291–300 of 490 articles
« Prev 1 28 29 30 31 32 49 Next »
Advertisements