mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-03 01:14:46 -04:00
Fixed more off-by-one errors in playback ratios. Fixed some clickability problems with the scrubber handle.
This commit is contained in:
parent
b8d59cb179
commit
b2592aad8c
4 changed files with 12 additions and 8 deletions
app
lib/surface
styles/play
views/play/level
|
@ -249,7 +249,7 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
createjs.Tween.removeTweens(@)
|
createjs.Tween.removeTweens(@)
|
||||||
@currentFrame = @scrubbingTo
|
@currentFrame = @scrubbingTo
|
||||||
|
|
||||||
@scrubbingTo = Math.min(Math.round(progress * @world.frames.length), @world.frames.length)
|
@scrubbingTo = Math.min(Math.round(progress * (@world.frames.length - 1)), @world.frames.length - 1)
|
||||||
@scrubbingPlaybackSpeed = Math.sqrt(Math.abs(@scrubbingTo - @currentFrame) * @world.dt / (scrubDuration or 0.5))
|
@scrubbingPlaybackSpeed = Math.sqrt(Math.abs(@scrubbingTo - @currentFrame) * @world.dt / (scrubDuration or 0.5))
|
||||||
if scrubDuration
|
if scrubDuration
|
||||||
t = createjs.Tween
|
t = createjs.Tween
|
||||||
|
@ -433,7 +433,7 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
@setWorld event.world
|
@setWorld event.world
|
||||||
@onFrameChanged(true)
|
@onFrameChanged(true)
|
||||||
fastForwardBuffer = 2
|
fastForwardBuffer = 2
|
||||||
if @playing and not @realTime and (ffToFrame = Math.min(event.firstChangedFrame, @frameBeforeCast, @world.frames.length)) and ffToFrame > @currentFrame + fastForwardBuffer * @world.frameRate
|
if @playing and not @realTime and (ffToFrame = Math.min(event.firstChangedFrame, @frameBeforeCast, @world.frames.length - 1)) and ffToFrame > @currentFrame + fastForwardBuffer * @world.frameRate
|
||||||
@fastForwardingToFrame = ffToFrame
|
@fastForwardingToFrame = ffToFrame
|
||||||
@fastForwardingSpeed = Math.max 4, 4 * 90 / (@world.maxTotalFrames * @world.dt)
|
@fastForwardingSpeed = Math.max 4, 4 * 90 / (@world.maxTotalFrames * @world.dt)
|
||||||
else if @realTime
|
else if @realTime
|
||||||
|
|
|
@ -123,7 +123,7 @@ $level-resize-transition-time: 0.5s
|
||||||
|
|
||||||
.gradient
|
.gradient
|
||||||
position: absolute
|
position: absolute
|
||||||
z-index: 10
|
z-index: 5
|
||||||
|
|
||||||
#code-area-gradient
|
#code-area-gradient
|
||||||
top: 0px
|
top: 0px
|
||||||
|
|
|
@ -100,25 +100,29 @@
|
||||||
// Can't do this transition because handle then jitters, but would be good for streaming.
|
// Can't do this transition because handle then jitters, but would be good for streaming.
|
||||||
//@include transition(width .2s linear)
|
//@include transition(width .2s linear)
|
||||||
|
|
||||||
&.disabled
|
&.disabled, &.ui-slider-disabled
|
||||||
cursor: default
|
cursor: default
|
||||||
|
|
||||||
|
.progress-bar .scrubber-handle
|
||||||
|
cursor: default
|
||||||
|
|
||||||
.progress-bar
|
.progress-bar
|
||||||
@include transition(width .0s linear)
|
@include transition(width .0s linear)
|
||||||
position: relative
|
position: relative
|
||||||
pointer-events: none
|
|
||||||
// Remove gradient background in favor of solid fill
|
// Remove gradient background in favor of solid fill
|
||||||
background-color: #67A4C8
|
background-color: #67A4C8
|
||||||
//background-image: none // gradient looks kind of cool though; keep it in
|
//background-image: none // gradient looks kind of cool though; keep it in
|
||||||
|
|
||||||
.scrubber-handle
|
.scrubber-handle
|
||||||
|
cursor: pointer
|
||||||
position: absolute
|
position: absolute
|
||||||
pointer-events: none
|
|
||||||
right: -16px
|
right: -16px
|
||||||
top: -9px
|
top: -9px
|
||||||
background: transparent url(/images/level/playback_thumb.png)
|
background: transparent url(/images/level/playback_thumb.png)
|
||||||
width: 32px
|
width: 32px
|
||||||
height: 32px
|
height: 32px
|
||||||
|
// z: above the gradient line bordering the playback bar
|
||||||
|
z-index: 6
|
||||||
|
|
||||||
.ui-slider-handle
|
.ui-slider-handle
|
||||||
height: 100%
|
height: 100%
|
||||||
|
|
|
@ -179,8 +179,8 @@ module.exports = class LevelPlaybackView extends CocoView
|
||||||
@updateBarWidth e.world.frames.length, e.world.maxTotalFrames, e.world.dt
|
@updateBarWidth e.world.frames.length, e.world.maxTotalFrames, e.world.dt
|
||||||
|
|
||||||
updateBarWidth: (loadedFrameCount, maxTotalFrames, dt) ->
|
updateBarWidth: (loadedFrameCount, maxTotalFrames, dt) ->
|
||||||
@totalTime = loadedFrameCount * dt
|
@totalTime = (loadedFrameCount - 1) * dt
|
||||||
pct = parseInt(100 * loadedFrameCount / maxTotalFrames) + '%'
|
pct = parseInt(100 * loadedFrameCount / (maxTotalFrames - 1)) + '%'
|
||||||
@barWidth = $('.progress', @$el).css('width', pct).show().width()
|
@barWidth = $('.progress', @$el).css('width', pct).show().width()
|
||||||
$('.scrubber .progress', @$el).slider('enable', true)
|
$('.scrubber .progress', @$el).slider('enable', true)
|
||||||
@newTime = 0
|
@newTime = 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue