Skip to content

Commit

Permalink
Fix width and height calculations when calculated outside of context
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh committed Feb 12, 2018
1 parent 0590c8c commit a32809d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions framer/SVGBaseLayer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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?
Expand Down

0 comments on commit a32809d

Please sign in to comment.