Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #271 from koenbok/check-setter-equal
Don't set the same values for layer
- Loading branch information
Showing
with
7 additions
and
4 deletions.
-
+7
−4
framer/Layer.coffee
|
@@ -22,19 +22,22 @@ layerProperty = (obj, name, cssProperty, fallback, validator, transformer, optio |
|
|
result = |
|
|
default: fallback |
|
|
get: -> |
|
|
|
|
|
# console.log "Layer.#{name}.get #{@_properties[name]}", @_properties.hasOwnProperty(name) |
|
|
|
|
|
return @_properties[name] if @_properties.hasOwnProperty(name) |
|
|
return fallback |
|
|
|
|
|
set: (value) -> |
|
|
|
|
|
# console.log "Layer.#{name}.set #{value}" |
|
|
# console.log "Layer.#{name}.set #{value} current:#{@[name]}" |
|
|
|
|
|
if value and transformer |
|
|
value = transformer(value) |
|
|
else if value == null and transformer |
|
|
if transformer and (value or value is null) |
|
|
value = transformer(value) |
|
|
|
|
|
# Return unless we get a new value |
|
|
return if value is @_properties[name] |
|
|
|
|
|
if value and validator and not validator(value) |
|
|
layerValueTypeError(name, value) |
|
|
|
|
|