svg-flat-document
SVG document without tree (flat)
Last updated 4 years ago by dawee .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install svg-flat-document 
SYNC missed versions from official npm registry.

SVGFlatDocument

ES6 SVG document without tree (flat)

Install

npm install svg-flat-document

Usage

Parse from SVG string

import SVGFlatDocument from 'svg-flat-document';

let doc = SVGFlatDocument.parse(svgString);

With svgString =

<svg width=100>
  <g transform="translate(100, 0)">
    <rect id="me" x="0" y="0" width="100" height="200" />
  </g>
</svg>

Retreive element


let node = doc.mapping.me;
let attr = node.attributes;

console.log(attr.x, attr.y, attr.width, attr.height);
// 0 0 100 200

console.log(attr.transform);
// matrix(1,0,0,1,100,0)

So groups are ignored and children absorb every parents transforms.

Current Tags

  • 0.0.4                                ...           latest (4 years ago)

4 Versions

  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (5)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |