Permalink
Browse files

Fix width and height calculations when calculated outside of context

  • Loading branch information...
nvh committed Feb 12, 2018
1 parent 0590c8c commit a32809d3af7ea3193ef0ddb85faf7c8bf0b645e1
Showing with 8 additions and 3 deletions.
  1. +8 −3 framer/SVGBaseLayer.coffee
View
@@ -165,7 +165,12 @@ class exports.SVGBaseLayer extends Layer
calculateSize: ->
element = @_element
measuredElement = null
if not Framer?.CurrentContext.elementInDOM
scaleX = 1
scaleY = 1
if Framer?.CurrentContext.elementInDOM
scaleX = @_parent.canvasScaleX()
scaleY = @_parent.canvasScaleY()
else
parent = @_element.parentElement
reference = @_element.nextSibling
svgMeasure = getSVGMeasureElement()
@@ -174,8 +179,8 @@ class exports.SVGBaseLayer extends Layer
element = measuredElement
rect = element.getBoundingClientRect()
@_width = rect.width / @_parent.canvasScaleX()
@_height = rect.height / @_parent.canvasScaleY()
@_width = rect.width / scaleX
@_height = rect.height / scaleY
if measuredElement?
if reference?

0 comments on commit a32809d

Please sign in to comment.