Skip to content
Browse files

Setting the translation of SVG elements

  • Loading branch information
nvh committed Jan 16, 2018
1 parent 43fd2a4 commit 75be5e77d1ae5678da8080574d60106f340ff939
Showing with 5 additions and 1 deletion.
  1. +5 −1 framer/
@@ -74,17 +74,21 @@ class exports.SVGBaseLayer extends Layer

pathProperties = ["fill", "stroke", "stroke-width", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke-dasharray", "stroke-dashoffset", "name"]
_.defaults options, @constructor.attributesFromElement(pathProperties, element)
if @_element.transform.baseVal.numberOfItems > 0
translate = @_element.transform.baseVal.getItem(0).matrix
options.x ?= translate.e
options.y ?= translate.f


rect = @_element.getBoundingClientRect()
@_width = rect.width * @context.pixelMultiplier
@_height = rect.height * @context.pixelMultiplier

for parent in @ancestors()
if parent instanceof SVGLayer
@_svg = parent.svg

for prop in ["frame", "stroke", "strokeWidth", "strokeLinecap", "strokeLinejoin", "strokeMiterlimit", "strokeDasharray", "strokeDashoffset", "rotation", "scale"]
@on "change:#{prop}", @resetViewbox

0 comments on commit 75be5e7

Please sign in to comment.
You can’t perform that action at this time.