Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taiseen/learning-react-fabric-js
React - Fabric JS - Canvas Drawing...
https://github.com/taiseen/learning-react-fabric-js
canvas context-api fabric-js local-storage modular-design react-hot-toast react-js tailwind-css
Last synced: 3 days ago
JSON representation
React - Fabric JS - Canvas Drawing...
- Host: GitHub
- URL: https://github.com/taiseen/learning-react-fabric-js
- Owner: taiseen
- Created: 2022-09-27T01:58:47.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-23T17:35:32.000Z (about 1 year ago)
- Last Synced: 2024-11-13T10:12:15.724Z (3 days ago)
- Topics: canvas, context-api, fabric-js, local-storage, modular-design, react-hot-toast, react-js, tailwind-css
- Language: JavaScript
- Homepage: https://react-fabric-js.netlify.app
- Size: 266 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> 27 - Sep - 2022
## Fabric Js Learning...
### Tailwind setup
* yarn add -D tailwindcss postcss autoprefixer
* npx tailwindcss init -p
* tailwind.config### Fabric Js
* yarn add fabric
* yarn add react-hot-toast## Features:-
* πΎ save data at local-storage + β¨ key operation
* π preventing app crash, when save data become undefined...
* π load data from local-storage...
* β single object delete operation + β¨ key operation
* β multiple object delete operation + β¨ key operation
* πΈ save as image, whole canvas drawing + β¨ key operation
* π ° select all object that draw in canvas + β¨ key operation
* π canvas zoom functionality
* β¨ "tab" key press event to navigate inside canvas object for selection...
* β¨ Check that Caps Lock is on
* π±οΈ Get the mouse position
* π StickyNote demo testing add...
```
Developers describe Fabric.js as "The easiest way to work with HTML5 canvas".
It provides interactive object model on top of canvas element.
Fabric also has SVG-to-canvas (and canvas-to-SVG) parser.
Using Fabric.js, you can create and populate objects on canvas, objects like simple geometrical shapes.
``````
Things to keep in mind:
When inspecting the canvas, itβs important to note that there are two layers that exist
1) upper canvas &
2) lower canvasThe upper canvas is utilized by the Fabric.js API for handling events, groupings, etc.
while weβre actually working on the lower canvas layer & The lower canvas contains the id we defined
```* `canvas.clear()` will clear all objects on canvas.
* `canvas.dispose()` will clear all objects on canvas & remove all listeners.## File & Folder hierarchy
```
src
βββ assets
| βββ Brush.jsx
| βββ Circle.jsx
| βββ Eraser.jsx
| βββ index.js
| βββ Rectangle.jsx
| βββ Text.jsx
| βββ Triangle.jsx
|
βββ components
| βββ Canvas.jsx
| βββ CanvasLine.jsx
| βββ Row1.jsx
| βββ Row2.jsx
|
βββ context
| βββ CanvasContext.js
|
βββ drawingTools
| βββ draw-i-Text.js
| βββ drawCircle.js
| βββ drawingBrush.js
| βββ drawRectangle.js
| βββ drawText.js
| βββ drawTextBox.js
| βββ drawTriangle.js
|
βββ features
| βββ copyPasteSelect.js
| βββ delete.js
| βββ loadSVG.js
| βββ mouseHover.js
| βββ r&d.js
| βββ save.js
| βββ search.js
| βββ utils.js
| βββ zoom.js
|
βββ style
| βββ index.css
|
βββ App.jsx
βββ index.js
```