Give focus back to spell view on palette click.

This commit is contained in:
Nick Winter 2014-03-23 16:48:30 -07:00
parent 4a47c5b517
commit dbeb3d445b
5 changed files with 11 additions and 16 deletions

View file

@ -7,7 +7,7 @@ World = require 'lib/world/world'
# Also uncomment vendor_with_box2d.js in index.html if you want Collision to run and things to move. # Also uncomment vendor_with_box2d.js in index.html if you want Collision to run and things to move.
module.exports = class God module.exports = class God
@ids: ['Athena', 'Baldr', 'Crom', 'Dagr', 'Eris', 'Freyja', 'Great Gish', 'Hades', 'Ishtar', 'Janus', 'Khronos', 'Loki', 'Marduk', 'Negafook', 'Odin', 'Poseidon', 'Quetzalcoatl', 'Ra', 'Shiva', 'Thor', 'Umvelinqangi', 'Týr', 'Vishnu', 'Wepwawet', 'Xipe Totec', 'Yahweh', 'Zeus', '上帝', 'Tiamat', '盘古', 'Phoebe', 'Artemis', 'Osiris', "嫦娥", 'Anhur', 'Teshub', 'Enlil', 'Perkele', 'Aether', 'Chaos', 'Hera', 'Iris', 'Theia', 'Uranus', 'Stribog', 'Sabazios', 'Izanagi', 'Ao', 'Tāwhirimātea', 'Tengri', 'Inmar', 'Torngarsuk', 'Centzonhuitznahua', 'Hunab Ku', 'Apollo', 'Helios', 'Thoth', 'Hyperion', 'Alectrona', 'Eos', 'Mitra', 'Saranyu', 'Freyr', 'Koyash', 'Atropos', 'Clotho', 'Lachesis', 'Tyche', 'Skuld', 'Urðr', 'Verðandi', 'Camaxtli', 'Huhetotl', 'Set', 'Anu', 'Allah', 'Anshar', 'Hermes', 'Lugh', 'Brigit', 'Manannan Mac Lir', 'Persephone', 'Mercury', 'Venus', 'Mars', 'Azrael', 'He-Man', 'Anansi', 'Issek', 'Mog', 'Kos', 'Amaterasu Omikami', 'Raijin', 'Susanowo', 'Blind Io', 'The Lady', 'Offler', 'Ptah', 'Anubis', 'Ereshkigal', 'Nergal', 'Thanatos', 'Macaria', 'Angelos', 'Erebus', 'Hecate', 'Hel', 'Orcus', 'Ishtar-Deela Nakh', 'Prometheus', 'Hephaestos', 'Sekhmet', 'Ares', 'Enyo', 'Otrera', 'Pele', 'Hadúr', 'Hachiman', 'Dayisun Tngri', 'Ullr', 'Lua', 'Minerva'] @ids: ['Athena', 'Baldr', 'Crom', 'Dagr', 'Eris', 'Freyja', 'Great Gish', 'Hades', 'Ishtar', 'Janus', 'Khronos', 'Loki', 'Marduk', 'Negafook', 'Odin', 'Poseidon', 'Quetzalcoatl', 'Ra', 'Shiva', 'Thor', 'Umvelinqangi', 'Týr', 'Vishnu', 'Wepwawet', 'Xipe Totec', 'Yahweh', 'Zeus', '上帝', 'Tiamat', '盘古', 'Phoebe', 'Artemis', 'Osiris', "嫦娥", 'Anhur', 'Teshub', 'Enlil', 'Perkele', 'Chaos', 'Hera', 'Iris', 'Theia', 'Uranus', 'Stribog', 'Sabazios', 'Izanagi', 'Ao', 'Tāwhirimātea', 'Tengri', 'Inmar', 'Torngarsuk', 'Centzonhuitznahua', 'Hunab Ku', 'Apollo', 'Helios', 'Thoth', 'Hyperion', 'Alectrona', 'Eos', 'Mitra', 'Saranyu', 'Freyr', 'Koyash', 'Atropos', 'Clotho', 'Lachesis', 'Tyche', 'Skuld', 'Urðr', 'Verðandi', 'Camaxtli', 'Huhetotl', 'Set', 'Anu', 'Allah', 'Anshar', 'Hermes', 'Lugh', 'Brigit', 'Manannan Mac Lir', 'Persephone', 'Mercury', 'Venus', 'Mars', 'Azrael', 'He-Man', 'Anansi', 'Issek', 'Mog', 'Kos', 'Amaterasu Omikami', 'Raijin', 'Susanowo', 'Blind Io', 'The Lady', 'Offler', 'Ptah', 'Anubis', 'Ereshkigal', 'Nergal', 'Thanatos', 'Macaria', 'Angelos', 'Erebus', 'Hecate', 'Hel', 'Orcus', 'Ishtar-Deela Nakh', 'Prometheus', 'Hephaestos', 'Sekhmet', 'Ares', 'Enyo', 'Otrera', 'Pele', 'Hadúr', 'Hachiman', 'Dayisun Tngri', 'Ullr', 'Lua', 'Minerva']
@nextID: -> @nextID: ->
@lastID = (if @lastID? then @lastID + 1 else Math.floor(@ids.length * Math.random())) % @ids.length @lastID = (if @lastID? then @lastID + 1 else Math.floor(@ids.length * Math.random())) % @ids.length
@ids[@lastID] @ids[@lastID]
@ -52,7 +52,7 @@ module.exports = class God
onWorkerMessage: (event) => onWorkerMessage: (event) =>
worker = event.target worker = event.target
if event.data.type is 'worker-initialized' if event.data.type is 'worker-initialized'
#console.log "Worker initialized after", ((new Date()) - worker.creationTime), "ms (before it was needed)" #console.log @id, "worker initialized after", ((new Date()) - worker.creationTime), "ms (before it was needed)"
worker.initialized = true worker.initialized = true
worker.removeEventListener 'message', @onWorkerMessage worker.removeEventListener 'message', @onWorkerMessage

View file

@ -143,9 +143,9 @@ module.exports = class ThangType extends CocoModel
@builder.buildAsync() unless buildQueue.length > 1 @builder.buildAsync() unless buildQueue.length > 1
@builder.on 'complete', @onBuildSpriteSheetComplete, @, true, key @builder.on 'complete', @onBuildSpriteSheetComplete, @, true, key
return true return true
t0 = new Date().getTime() t0 = new Date()
spriteSheet = @builder.build() spriteSheet = @builder.build()
console.warn "Built #{@get('name')} in #{new Date().getTime() - t0}ms on main thread." console.warn "Built #{@get('name')} in #{new Date() - t0}ms on main thread."
@spriteSheets[key] = spriteSheet @spriteSheets[key] = spriteSheet
delete @building[key] delete @building[key]
spriteSheet spriteSheet

View file

@ -9,8 +9,6 @@
border: 1px solid transparent border: 1px solid transparent
cursor: pointer cursor: pointer
@include user-select(all) @include user-select(all)
::selection
background: transparent
&:hover &:hover
border: 1px solid #000000 border: 1px solid #000000

View file

@ -19,10 +19,10 @@ module.exports = class LadderTabView extends CocoView
id: 'ladder-tab-view' id: 'ladder-tab-view'
template: require 'templates/play/ladder/ladder_tab' template: require 'templates/play/ladder/ladder_tab'
startsLoading: true startsLoading: true
events: events:
'click .connect-facebook': 'onConnectFacebook' 'click .connect-facebook': 'onConnectFacebook'
subscriptions: subscriptions:
'facebook-logged-in': 'onConnectedWithFacebook' 'facebook-logged-in': 'onConnectedWithFacebook'
@ -48,13 +48,13 @@ module.exports = class LadderTabView extends CocoView
# FACEBOOK # FACEBOOK
# Connect button pressed # Connect button pressed
onConnectFacebook: -> onConnectFacebook: ->
@connecting = true @connecting = true
FB.login() FB.login()
onConnectedWithFacebook: -> location.reload() if @connecting onConnectedWithFacebook: -> location.reload() if @connecting
# Load friends # Load friends
loadFacebookFriendSessions: -> loadFacebookFriendSessions: ->
@ -101,7 +101,7 @@ module.exports = class LadderTabView extends CocoView
onGPlusFriendSessionsLoaded: (result) => onGPlusFriendSessionsLoaded: (result) =>
@loadingGPlusFriends = false @loadingGPlusFriends = false
@renderMaybe() @renderMaybe()
# LADDER LOADING # LADDER LOADING
refreshLadder: -> refreshLadder: ->
@ -117,7 +117,7 @@ module.exports = class LadderTabView extends CocoView
leaderboardsLoaded: => leaderboardsLoaded: =>
@loadingLeaderboards = false @loadingLeaderboards = false
@renderMaybe() @renderMaybe()
renderMaybe: -> renderMaybe: ->
return if @loadingFacebookFriends or @loadingLeaderboards return if @loadingFacebookFriends or @loadingLeaderboards
@startsLoading = false @startsLoading = false

View file

@ -171,9 +171,6 @@ module.exports = class SpellPaletteEntryView extends View
Backbone.Mediator.publish 'tome:palette-pin-toggled', entry: @, pinned: @popoverPinned Backbone.Mediator.publish 'tome:palette-pin-toggled', entry: @, pinned: @popoverPinned
onClick: (e) => onClick: (e) =>
unless @popoverPinned
$(e.target).selectText()
e.stopPropagation() # don't re-focus editor since we might want to select text
@togglePinned() @togglePinned()
Backbone.Mediator.publish 'tome:palette-clicked', thang: @thang, prop: @doc.name, entry: @ Backbone.Mediator.publish 'tome:palette-clicked', thang: @thang, prop: @doc.name, entry: @