Skip to content

Commit

Permalink
Improved keeping track of previous background color
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh committed Apr 24, 2017
1 parent 63333cf commit bce05cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions framer/Components/DeviceComponent.coffee
Expand Up @@ -75,6 +75,7 @@ class exports.DeviceComponent extends BaseClass
@background.clip = true @background.clip = true
@background.backgroundColor = "transparent" @background.backgroundColor = "transparent"
@background.classList.add("DeviceBackground") @background.classList.add("DeviceBackground")
@_previousBackgroundColor = @background.backgroundColor


@hands = new Layer @hands = new Layer
@handsImageLayer = new Layer parent: @hands @handsImageLayer = new Layer parent: @hands
Expand Down Expand Up @@ -370,7 +371,10 @@ class exports.DeviceComponent extends BaseClass
@_previousBackgroundColor = @background.backgroundColor @_previousBackgroundColor = @background.backgroundColor
@background.backgroundColor = @screen.backgroundColor @background.backgroundColor = @screen.backgroundColor
@screen.on "change:backgroundColor", (color) => @screen.on "change:backgroundColor", (color) =>
# Hacky way to keep the prev backgroundColor
prev = @_previousBackgroundColor
@background.backgroundColor = color @background.backgroundColor = color
@_previousBackgroundColor = prev
@background.on "change:backgroundColor", (color) => @background.on "change:backgroundColor", (color) =>
@_previousBackgroundColor = color @_previousBackgroundColor = color
@background.backgroundColor = @screen.backgroundColor @background.backgroundColor = @screen.backgroundColor
Expand Down

0 comments on commit bce05cc

Please sign in to comment.