How to use the svgdom.roundMatrix function in svgdom

To help you get started, we’ve selected a few svgdom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github svgdotjs / svg.js / spec / spec / helper.js View on Github external
.split(SVG.regex.delimiter)
    .map(parseFloat)
}

// This is needed because of IE11 creating values like 2.99999 when calculating a transformed box
window.roundBox = function(box) {
  return new SVG.Box(
    Math.round(box.x),
    Math.round(box.y),
    Math.round(box.width),
    Math.round(box.height)
  )
}

// Same thing here with matrices
window.roundMatrix = function (mat) {
  return new SVG.Matrix(
    +(mat.a.toFixed(5)),
    +(mat.b.toFixed(5)),
    +(mat.c.toFixed(5)),
    +(mat.d.toFixed(5)),
    +(mat.e.toFixed(5)),
    +(mat.f.toFixed(5))
  )
}

svgdom

Straightforward DOM implementation for SVG, HTML and XML

MIT
Latest version published 1 year ago

Package Health Score

61 / 100
Full package analysis