mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Round inferred cooldown docs. Show grabber/grabbing cursor when Surface is enabled, playing, and zoomed in.
This commit is contained in:
parent
f16c1b5030
commit
5d54332ed7
5 changed files with 23 additions and 3 deletions
|
@ -285,7 +285,7 @@ module.exports = class Camera extends CocoClass
|
|||
@currentTarget = target
|
||||
viewportDifference = @updateViewports target
|
||||
if viewportDifference > 0.1 # Roughly 0.1 pixel difference in what we can see
|
||||
Backbone.Mediator.publish 'camera:zoom-updated', camera: @, zoom: @zoom, surfaceViewport: @surfaceViewport
|
||||
Backbone.Mediator.publish 'camera:zoom-updated', camera: @, zoom: @zoom, surfaceViewport: @surfaceViewport, minZoom: @minZoom
|
||||
|
||||
boundTarget: (pos, zoom) ->
|
||||
# Given an {x, y} in Surface coordinates, return one that will keep our viewport on the Surface.
|
||||
|
|
|
@ -384,6 +384,11 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
if @ended
|
||||
@setPaused false
|
||||
@surfaceZoomPauseTimeout = _.delay (=> @setPaused true), 3000
|
||||
@zoomedIn = e.zoom > e.minZoom * 1.1
|
||||
@updateGrabbability()
|
||||
|
||||
updateGrabbability: ->
|
||||
@webGLCanvas.toggleClass 'grabbable', @zoomedIn and not @playing and not @disabled
|
||||
|
||||
onDisableControls: (e) ->
|
||||
return if e.controls and not ('surface' in e.controls)
|
||||
|
@ -400,6 +405,7 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
|
||||
setDisabled: (@disabled) ->
|
||||
@lankBoss.disabled = @disabled
|
||||
@updateGrabbability()
|
||||
|
||||
onSetPlaying: (e) ->
|
||||
@playing = (e ? {}).playing ? true
|
||||
|
@ -408,6 +414,7 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
@currentFrame = 1 # Go back to the beginning (but not frame 0, that frame is weird)
|
||||
if @fastForwardingToFrame and not @playing
|
||||
@fastForwardingToFrame = null
|
||||
@updateGrabbability()
|
||||
|
||||
onSetTime: (e) ->
|
||||
toFrame = @currentFrame
|
||||
|
|
|
@ -23,6 +23,7 @@ module.exports = # /app/lib/surface
|
|||
camera: {type: 'object'}
|
||||
zoom: {type: 'number', minimum: 0, exclusiveMinimum: true}
|
||||
surfaceViewport: {type: 'object'}
|
||||
minZoom: {type: 'number', minimum: 0, exclusiveMinimum: true}
|
||||
|
||||
'camera:set-camera': c.object {},
|
||||
pos: c.object {required: ['x', 'y']},
|
||||
|
|
|
@ -90,6 +90,16 @@ $level-resize-transition-time: 0.5s
|
|||
z-index: 2
|
||||
@include transition($level-resize-transition-time ease-out)
|
||||
|
||||
&.grabbable:not(.flag-color-selected)
|
||||
cursor: -moz-grab
|
||||
cursor: -webkit-grab
|
||||
cursor: grab
|
||||
|
||||
&:active
|
||||
cursor: -moz-grabbing
|
||||
cursor: -webkit-grabbing
|
||||
cursor: grabbing
|
||||
|
||||
&.flag-color-selected
|
||||
cursor: crosshair
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ module.exports = class DocFormatter
|
|||
else
|
||||
v = window[@doc.owner][@doc.name] # grab Math or Vector
|
||||
if @doc.type is 'number' and not _.isNaN v
|
||||
if v == Math.round v
|
||||
if v is Math.round v
|
||||
return v
|
||||
if _.isNumber v
|
||||
return v.toFixed 2
|
||||
|
@ -165,5 +165,7 @@ module.exports = class DocFormatter
|
|||
return null unless action
|
||||
cooldowns = cooldown: action.cooldown, specificCooldown: action.specificCooldown, name: actionName, type: type
|
||||
for prop in ['range', 'radius', 'duration', 'damage']
|
||||
cooldowns[prop] = owner[_.string.camelize actionName + _.string.capitalize(prop)]
|
||||
cooldowns[prop] = v = owner[_.string.camelize actionName + _.string.capitalize(prop)]
|
||||
if _.isNumber(v) and v isnt Math.round v
|
||||
cooldowns[prop] = v.toFixed 2
|
||||
cooldowns
|
||||
|
|
Loading…
Reference in a new issue