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
app
lib/surface
schemas/subscriptions
styles/play
views/play/level/tome
|
@ -285,7 +285,7 @@ module.exports = class Camera extends CocoClass
|
||||||
@currentTarget = target
|
@currentTarget = target
|
||||||
viewportDifference = @updateViewports target
|
viewportDifference = @updateViewports target
|
||||||
if viewportDifference > 0.1 # Roughly 0.1 pixel difference in what we can see
|
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) ->
|
boundTarget: (pos, zoom) ->
|
||||||
# Given an {x, y} in Surface coordinates, return one that will keep our viewport on the Surface.
|
# 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
|
if @ended
|
||||||
@setPaused false
|
@setPaused false
|
||||||
@surfaceZoomPauseTimeout = _.delay (=> @setPaused true), 3000
|
@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) ->
|
onDisableControls: (e) ->
|
||||||
return if e.controls and not ('surface' in e.controls)
|
return if e.controls and not ('surface' in e.controls)
|
||||||
|
@ -400,6 +405,7 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
|
|
||||||
setDisabled: (@disabled) ->
|
setDisabled: (@disabled) ->
|
||||||
@lankBoss.disabled = @disabled
|
@lankBoss.disabled = @disabled
|
||||||
|
@updateGrabbability()
|
||||||
|
|
||||||
onSetPlaying: (e) ->
|
onSetPlaying: (e) ->
|
||||||
@playing = (e ? {}).playing ? true
|
@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)
|
@currentFrame = 1 # Go back to the beginning (but not frame 0, that frame is weird)
|
||||||
if @fastForwardingToFrame and not @playing
|
if @fastForwardingToFrame and not @playing
|
||||||
@fastForwardingToFrame = null
|
@fastForwardingToFrame = null
|
||||||
|
@updateGrabbability()
|
||||||
|
|
||||||
onSetTime: (e) ->
|
onSetTime: (e) ->
|
||||||
toFrame = @currentFrame
|
toFrame = @currentFrame
|
||||||
|
|
|
@ -23,6 +23,7 @@ module.exports = # /app/lib/surface
|
||||||
camera: {type: 'object'}
|
camera: {type: 'object'}
|
||||||
zoom: {type: 'number', minimum: 0, exclusiveMinimum: true}
|
zoom: {type: 'number', minimum: 0, exclusiveMinimum: true}
|
||||||
surfaceViewport: {type: 'object'}
|
surfaceViewport: {type: 'object'}
|
||||||
|
minZoom: {type: 'number', minimum: 0, exclusiveMinimum: true}
|
||||||
|
|
||||||
'camera:set-camera': c.object {},
|
'camera:set-camera': c.object {},
|
||||||
pos: c.object {required: ['x', 'y']},
|
pos: c.object {required: ['x', 'y']},
|
||||||
|
|
|
@ -90,6 +90,16 @@ $level-resize-transition-time: 0.5s
|
||||||
z-index: 2
|
z-index: 2
|
||||||
@include transition($level-resize-transition-time ease-out)
|
@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
|
&.flag-color-selected
|
||||||
cursor: crosshair
|
cursor: crosshair
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ module.exports = class DocFormatter
|
||||||
else
|
else
|
||||||
v = window[@doc.owner][@doc.name] # grab Math or Vector
|
v = window[@doc.owner][@doc.name] # grab Math or Vector
|
||||||
if @doc.type is 'number' and not _.isNaN v
|
if @doc.type is 'number' and not _.isNaN v
|
||||||
if v == Math.round v
|
if v is Math.round v
|
||||||
return v
|
return v
|
||||||
if _.isNumber v
|
if _.isNumber v
|
||||||
return v.toFixed 2
|
return v.toFixed 2
|
||||||
|
@ -165,5 +165,7 @@ module.exports = class DocFormatter
|
||||||
return null unless action
|
return null unless action
|
||||||
cooldowns = cooldown: action.cooldown, specificCooldown: action.specificCooldown, name: actionName, type: type
|
cooldowns = cooldown: action.cooldown, specificCooldown: action.specificCooldown, name: actionName, type: type
|
||||||
for prop in ['range', 'radius', 'duration', 'damage']
|
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
|
cooldowns
|
||||||
|
|
Reference in a new issue