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.
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: ->
@lastID = (if @lastID? then @lastID + 1 else Math.floor(@ids.length * Math.random())) % @ids.length
@ids[@lastID]
@ -52,7 +52,7 @@ module.exports = class God
onWorkerMessage: (event) =>
worker = event.target
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.removeEventListener 'message', @onWorkerMessage

View file

@ -143,9 +143,9 @@ module.exports = class ThangType extends CocoModel
@builder.buildAsync() unless buildQueue.length > 1
@builder.on 'complete', @onBuildSpriteSheetComplete, @, true, key
return true
t0 = new Date().getTime()
t0 = new Date()
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
delete @building[key]
spriteSheet

View file

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

View file

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

View file

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