From ce84437345b11518ddf59535567cd6d44527f61d Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Fri, 11 Apr 2014 13:49:02 -0700 Subject: [PATCH 1/2] Updated treema version. --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 0c55d76af..be29667d4 100644 --- a/bower.json +++ b/bower.json @@ -39,7 +39,7 @@ "d3": "~3.4.4", "nanoscroller": "~0.8.0", "jquery.tablesorter": "~2.15.13", - "treema": "~0.0.1", + "treema": ">=0.0.1", "bootstrap": "~3.1.1", "validated-backbone-mediator": "~0.1.3" }, From 10bb17c38ab2edf5ea2ce3912cb16fe13f577e96 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Fri, 11 Apr 2014 14:03:13 -0700 Subject: [PATCH 2/2] Added getThangByID method to Thang. Handled a few error corner cases with the time popup. --- app/lib/world/thang.coffee | 3 +++ app/views/play/level/playback_view.coffee | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/lib/world/thang.coffee b/app/lib/world/thang.coffee index 426e7541f..e7ed50f05 100644 --- a/app/lib/world/thang.coffee +++ b/app/lib/world/thang.coffee @@ -42,6 +42,9 @@ module.exports = class Thang setGoalState: (goalID, status) -> @world.setGoalState goalID, status + getThangByID: (id) -> + @world.getThangByID id + addComponents: (components...) -> # We don't need to keep the components around after attaching them, but we will keep their initial config for recreating Thangs @components ?= [] diff --git a/app/views/play/level/playback_view.coffee b/app/views/play/level/playback_view.coffee index 4a3e4d359..a79594429 100644 --- a/app/views/play/level/playback_view.coffee +++ b/app/views/play/level/playback_view.coffee @@ -151,7 +151,7 @@ module.exports = class PlaybackView extends View @newTime = 0 @currentTime = 0 - @timePopup = new HoverPopup unless @timePopup? + @timePopup ?= new HoverPopup #TODO: Why do we need defaultValues here at all? Fallback language has been set to 'en'... oO @@ -192,7 +192,7 @@ module.exports = class PlaybackView extends View @$progressScrubber.slider('disable', true) catch e #console.warn('error disabling scrubber') - @timePopup.disable() + @timePopup?.disable() $('#volume-button', @$el).removeClass('disabled') onEnableControls: (e) -> @@ -203,7 +203,7 @@ module.exports = class PlaybackView extends View @$progressScrubber.slider('enable', true) catch e #console.warn('error enabling scrubber') - @timePopup.enable() + @timePopup?.enable() onSetPlaying: (e) -> @playing = (e ? {}).playing ? true @@ -242,21 +242,21 @@ module.exports = class PlaybackView extends View @lastProgress = e.progress onProgressEnter: (e) -> - #Why it needs itself as parameter you ask? Ask Twitter instead.. - @timePopup.enter @timePopup + # Why it needs itself as parameter you ask? Ask Twitter instead. + @timePopup?.enter @timePopup onProgressLeave: (e) -> - @timePopup.leave @timePopup + @timePopup?.leave @timePopup onProgressHover: (e) -> timeRatio = @$progressScrubber.width() / @totalTime @newTime = e.offsetX / timeRatio @updatePopupContent() - @timePopup.onHover e + @timePopup?.onHover e - #Show it instantaniously if close enough to current time. - if Math.abs(@currentTime - @newTime) < 1 and not @timePopup.shown - @timePopup.show() unless @timePopup.shown + # Show it instantaneously if close enough to current time. + if @timePopup and Math.abs(@currentTime - @newTime) < 1 and not @timePopup.shown + @timePopup.show() updateProgress: (progress) -> $('.scrubber .progress-bar', @$el).css('width', "#{progress*100}%")