mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-31 07:12:49 -04:00
Moved spell palette popovers to top placement if dialogue view is active.
This commit is contained in:
parent
c5ae253a45
commit
cee017c7ec
3 changed files with 10 additions and 7 deletions
app
styles/play/level/tome
views/play/level
|
@ -45,11 +45,15 @@
|
|||
// color: rgb(197, 6, 11)
|
||||
color: rgb(243, 169, 49)
|
||||
|
||||
|
||||
body:not(.dialogue-view-active)
|
||||
.spell-palette-popover.popover
|
||||
right: 45%
|
||||
min-width: 350px
|
||||
|
||||
.spell-palette-popover.popover
|
||||
// Only those popovers which are our direct children (spell documentation)
|
||||
max-width: 600px
|
||||
right: 45%
|
||||
min-width: 350px
|
||||
|
||||
&.pinned
|
||||
left: auto !important
|
||||
|
|
|
@ -19,13 +19,10 @@ module.exports = class LevelDialogueView extends CocoView
|
|||
onClick: (e) ->
|
||||
Backbone.Mediator.publish 'tome:focus-editor', {}
|
||||
|
||||
onFrameChanged: (e) ->
|
||||
@timeProgress = e.progress
|
||||
@update()
|
||||
|
||||
onSpriteDialogue: (e) ->
|
||||
return unless e.message
|
||||
@$el.addClass 'active speaking'
|
||||
$('body').addClass('dialogue-view-active')
|
||||
@setMessage e.message, e.mood, e.responses
|
||||
|
||||
window.tracker?.trackEvent 'Heard Sprite', {message: e.message, label: e.message}, ['Google Analytics']
|
||||
|
@ -35,6 +32,7 @@ module.exports = class LevelDialogueView extends CocoView
|
|||
|
||||
onSpriteClearDialogue: ->
|
||||
@$el.removeClass 'active speaking'
|
||||
$('body').removeClass('dialogue-view-active')
|
||||
|
||||
setMessage: (message, mood, responses) ->
|
||||
message = marked message
|
||||
|
|
|
@ -37,10 +37,11 @@ module.exports = class SpellPaletteEntryView extends CocoView
|
|||
afterRender: ->
|
||||
super()
|
||||
@$el.addClass(@doc.type)
|
||||
placement = -> if $('body').hasClass('dialogue-view-active') then 'top' else 'left'
|
||||
@$el.popover(
|
||||
animation: false
|
||||
html: true
|
||||
placement: 'left'
|
||||
placement: placement
|
||||
trigger: 'manual' # Hover, until they click, which will then pin it until unclick.
|
||||
content: @docFormatter.formatPopover()
|
||||
container: 'body'
|
||||
|
|
Loading…
Add table
Reference in a new issue