Skip to content
Browse files

Improving performance by not setting webkit* styles multiple times du…

…ring applyDefaults
  • Loading branch information
nvh committed Sep 5, 2017
1 parent fa5ddfa commit 242f61de0a0ccdedb8a0e4f9eeaeb3708d2aa0b2
Showing with 9 additions and 2 deletions.
  1. +9 −2 framer/
@@ -54,12 +54,13 @@ layerProperty = (obj, name, cssProperty, fallback, validator, transformer, optio

mainElement = @_element if includeMainElement or not targetElement
subElement = @[targetElement] if targetElement?

if cssProperty isnt null
if name is cssProperty and not LayerStyle[cssProperty]?
mainElement?.style[cssProperty] = @_properties[name]
subElement?.style[cssProperty] = @_properties[name]
else if not @__applyingDefaults
# These values are set multiple times during applyDefaults, so ignore them here, and set the style in the constructor
or (cssProperty not in ["webkitTransform", "webkitFilter", "webkitPerspectiveOrigin", "webkitTransformOrigin"])
style = LayerStyle[cssProperty](@)
mainElement?.style[cssProperty] = style
subElement?.style[cssProperty] = style
@@ -203,7 +204,13 @@ class exports.Layer extends BaseClass
options.parent = options.superLayer
delete options.superLayer

@__applyingDefaults = true
super Defaults.getDefaults("Layer", options)
delete @__applyingDefaults["webkitTransform"] = LayerStyle["webkitTransform"](@)["webkitFilter"] = LayerStyle["webkitFilter"](@)["webkitTransformOrigin"] = LayerStyle["webkitTransformOrigin"](@)["webkitPerspectiveOrigin"] = LayerStyle["webkitPerspectiveOrigin"](@)

# Add this layer to the current context

0 comments on commit 242f61d

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