All Projects → mondeja → svg-path-bbox

mondeja / svg-path-bbox

Licence: BSD-3-Clause license
SVG paths bounding box calculator

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to svg-path-bbox

lookpath
The minimum and most straightforward way to check if command exists and where the executable is, without spawning child_process.
Stars: ✭ 49 (+188.24%)
Mutual labels:  path
STPathTextField
Subclass of NSTextField that supports shell and browser-style path autocompletion
Stars: ✭ 17 (+0%)
Mutual labels:  path
get-bin-path
Get the current package's binary path
Stars: ✭ 25 (+47.06%)
Mutual labels:  path
coco-viewer
Simple COCO Viewer in Tkinter
Stars: ✭ 65 (+282.35%)
Mutual labels:  bbox
array-keyed-map
JS datastructure, like Map, but the keys are arrays
Stars: ✭ 29 (+70.59%)
Mutual labels:  path
llvm-epp
Efficient Path Profiling using LLVM
Stars: ✭ 16 (-5.88%)
Mutual labels:  path
stroke-dasharray-interpolation-talk
Slides from 2015 D3.js talk
Stars: ✭ 17 (+0%)
Mutual labels:  path
relative-path
Portable relative UTF-8 paths for Rust.
Stars: ✭ 54 (+217.65%)
Mutual labels:  path
groupoid.space
🧊 Інститут Формальної Математики
Stars: ✭ 35 (+105.88%)
Mutual labels:  path
XRadarView
A highly customizable radar view for Android
Stars: ✭ 106 (+523.53%)
Mutual labels:  path
path-replace-loader
Path replace loader for webpack
Stars: ✭ 14 (-17.65%)
Mutual labels:  path
SonogramView
Audio visualisation of song
Stars: ✭ 65 (+282.35%)
Mutual labels:  path
react-svg-pathline
React component for drawing SVG path through set of points, smoothing the corners
Stars: ✭ 42 (+147.06%)
Mutual labels:  path
global-prefix
Get the npm global path prefix. Same code used internally by npm.
Stars: ✭ 27 (+58.82%)
Mutual labels:  path
BezierKit
Bezier curves and paths in Swift for building vector applications
Stars: ✭ 190 (+1017.65%)
Mutual labels:  path
path-to-regexp-php
PHP port of https://github.com/pillarjs/path-to-regexp
Stars: ✭ 21 (+23.53%)
Mutual labels:  path
path-absolutize
A library for extending `Path` and `PathBuf` in order to get an absolute path and remove the containing dots.
Stars: ✭ 37 (+117.65%)
Mutual labels:  path
file-icon-cli
Get the icon of a file or app as a PNG image (macOS)
Stars: ✭ 73 (+329.41%)
Mutual labels:  path
geojson
GeoJSON classes for R
Stars: ✭ 32 (+88.24%)
Mutual labels:  bbox
path-that-svg
Path that SVG!
Stars: ✭ 45 (+164.71%)
Mutual labels:  path

📦 svg-path-bbox

NPM version License NodeJS versions

SVG paths bounding box calculator.

Status

Tests Coverage status

Install

npm install svg-path-bbox

Documentation

Usage

> import svgPathBbox from "svg-path-bbox";
> svgPathBbox("M5 10l2 3z")
[ 5, 10, 7, 13 ]
> svgPathBbox("M5 10c3 0 3 3 0 3z")
[ 5, 10, 7.25, 13 ]

Returned bounding box is an array made up like viewBox SVG attributes [x0, y0, x1, y1] of unrounded values:

Command line

$ svg-path-bbox "M5 10c3 0 3 3 0 3z"
5 10 7.25 13

$ svg-path-bbox "M5 10c3 0 3 3 0 3z" "M2 8m5 5z"
5 10 7.25 13
2 8 7 13

Typescript usage

import svgPathBbox from "svg-path-bbox";
import type { BBox } from "svg-path-bbox";

const cases: [string, BBox][] = [["M0 0H3V6Z", [0, 0, 3, 6]]];
console.log(svgPathBbox(cases[0]));

Reference

# svgPathBbox(d : string) ⇒ [minX: number, minY: number, maxX: number, maxY: number]

Computes the bounding box of SVG path following the SVG 1.1 specification.

  • d (string) SVG path.

Thanks to

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].