Permalink
Browse files

Fix originX and originY for SVG behavior

  • Loading branch information...
nvh committed Jan 17, 2018
1 parent ad45c89 commit cea1e51e23c0251803d64b18683b190f62c4eb8c
Showing with 10 additions and 0 deletions.
  1. +10 −0 framer/SVGBaseLayer.coffee
View
@@ -1,6 +1,14 @@
{Layer, layerProperty} = require "./Layer"
{Color} = require "./Color"
originTransform = (value, layer, name) ->
sizeProp = undefined
switch name
when "originX" then sizeProp = "width"
when "originY" then sizeProp = "height"
return value unless sizeProp?
return (layer[sizeProp] / layer.parent[sizeProp]) * value
class exports.SVGBaseLayer extends Layer
# Overridden Layer properties
@@ -13,6 +21,8 @@ class exports.SVGBaseLayer extends Layer
@define "html", get: -> @_element.outerHTML or ""
@define "width", get: -> @_width
@define "height", get: -> @_height
@define "originX", layerProperty(@, "originX", "webkitTransformOrigin", 0.5, _.isNumber, originTransform)
@define "originY", layerProperty(@, "originY", "webkitTransformOrigin", 0.5, _.isNumber, originTransform)
# Disabled properties
@undefine ["label", "blending", "image"]

0 comments on commit cea1e51

Please sign in to comment.