UNPKG

fabric-layers-core

Version:

A fabric.js coordinate-plane (grid) & layers library

105 lines (77 loc) • 2.24 kB
# Fabric Layers Core An interactive coordinate-plane, grid, and layer management library for [fabric.js](https://fabricjs.com/) canvases. `fabric-layers-core` is based on the excellent original work of [IndoorJS](https://github.com/mudin/indoorjs) by ## Publishing To publish a new version, run: ```bash yarn test ``` ```bash yarn build ``` if no errors, run: ```bash yarn release ``` ```bash git push --follow-tags origin main && npm publish ``` You will be prompted to enter a One-Time-Password (OTP) from your GitHub account. ## šŸš€ Running the Grid Demo To explore the grid functionality, follow these steps: 1. **Install Dependencies** ```bash yarn install ``` 2. **Build the Library** ```bash yarn build ``` 3. **Open the Demo** - Open `grid-demo.html` directly in your browser - The demo includes: - Interactive grid with zoom/pan functionality - Coordinate display - Zoom level controls - Reset view button 4. **Development Workflow** - cd ../fabric-layers-core && npm run build:watch - Make changes to the source code - Refresh the browser to see changes --- ## ✨ Classes ``` Base (EventEmitter2) ā”œā”€ā”€ Map (+ ModesMixin) │ ā”œā”€ā”€ Grid │ ā”œā”€ā”€ Point │ └── Measurement ā”œā”€ā”€ Layer │ ā”œā”€ā”€ Vector Layers (Line, Circle, Rect, Polyline) │ ā”œā”€ā”€ Marker System │ │ ā”œā”€ā”€ Marker │ │ ā”œā”€ā”€ MarkerGroup │ │ └── Icon │ ā”œā”€ā”€ Group │ ā”œā”€ā”€ Connector │ └── Tooltip ā”œā”€ā”€ Paint System │ ā”œā”€ā”€ Canvas │ ā”œā”€ā”€ Arrow │ ā”œā”€ā”€ ArrowHead │ └── PaintManager └── Measurement System ā”œā”€ā”€ Measurement └── Measurer ``` ## šŸ¤ Contributing PRs and issues are welcome! 1. Fork & `git clone` 2. `yarn install` 3. `yarn dev` – watch/build 4. Add tests in `test/` and run `yarn test` Please follow the [Conventional Commits](https://www.conventionalcommits.org/) spec; CI will lint commit messages. --- ## šŸ“„ Licenses MIT Ā© 2025 [Allen Joslin](https://github.com/ajoslin103) (current author of fabric-layers-core) MIT Ā© 2022 [Mudin](https://github.com/mudin) (original author of IndoorJS)