Permalink
Browse files

Move resetViewBox to SVGBaseLayer

  • Loading branch information...
nvh committed Jan 15, 2018
1 parent 07ac667 commit a909132c6d537c4ae73e39bab6f56ddaba5be13f
Showing with 7 additions and 6 deletions.
  1. +7 −0 framer/SVGBaseLayer.coffee
  2. +0 −6 framer/SVGPath.coffee
@@ -82,9 +82,16 @@ class exports.SVGBaseLayer extends Layer
@_svg = parent.svg
break

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

@define "gradient",
get: ->
console.warn "The gradient property is currently not supported on shapes"
return undefined
set: (value) ->
console.warn "The gradient property is currently not supported on shapes"

resetViewbox: =>
@_svg.setAttribute("viewBox", "0,0,#{@width},#{@height}")
@_svg.removeAttribute("viewBox")
@@ -26,12 +26,6 @@ class exports.SVGPath extends SVGBaseLayer
rect = @_element.getBoundingClientRect()
@_width = rect.width
@_height = rect.height
for prop in ["frame", "stroke", "strokeWidth", "strokeLinecap", "strokeLinejoin", "strokeMiterlimit", "strokeDasharray", "strokeDashoffset"]
@on "change:#{prop}", @resetViewbox

resetViewbox: =>
@_svg.setAttribute("viewBox", "0,0,#{@width},#{@height}")
@_svg.removeAttribute("viewBox")

# Custom properties
@define "fill", layerProperty(@, "fill", "fill", null, SVG.validFill, SVG.toFill)

0 comments on commit a909132

Please sign in to comment.