mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 19:06:59 -05:00
Disable body scrolling in Thang List
This overwrites the native scrolling behavior for the thangs-list div by manually setting the value of @scrollTop
This commit is contained in:
parent
882302d66e
commit
2c6c60307b
1 changed files with 6 additions and 1 deletions
|
@ -43,7 +43,7 @@ module.exports = class ThangsTabView extends View
|
||||||
'sprite:mouse-up': 'onSpriteMouseUp'
|
'sprite:mouse-up': 'onSpriteMouseUp'
|
||||||
'sprite:double-clicked': 'onSpriteDoubleClicked'
|
'sprite:double-clicked': 'onSpriteDoubleClicked'
|
||||||
'surface:stage-mouse-down': 'onStageMouseDown'
|
'surface:stage-mouse-down': 'onStageMouseDown'
|
||||||
|
|
||||||
shortcuts:
|
shortcuts:
|
||||||
'esc': -> @selectAddThang()
|
'esc': -> @selectAddThang()
|
||||||
|
|
||||||
|
@ -70,12 +70,17 @@ module.exports = class ThangsTabView extends View
|
||||||
return if @startsLoading
|
return if @startsLoading
|
||||||
super()
|
super()
|
||||||
$('.tab-content').click @selectAddThang
|
$('.tab-content').click @selectAddThang
|
||||||
|
$('#thangs-list').bind 'mousewheel', @preventBodyScrollingInThangList
|
||||||
key 'left', _.bind @moveAddThangSelection, @, -1
|
key 'left', _.bind @moveAddThangSelection, @, -1
|
||||||
key 'right', _.bind @moveAddThangSelection, @, 1
|
key 'right', _.bind @moveAddThangSelection, @, 1
|
||||||
key 'delete, del, backspace', @deleteSelectedExtantThang
|
key 'delete, del, backspace', @deleteSelectedExtantThang
|
||||||
key 'f', => Backbone.Mediator.publish('level-set-debug', debug: not @surface.debug)
|
key 'f', => Backbone.Mediator.publish('level-set-debug', debug: not @surface.debug)
|
||||||
key 'g', => Backbone.Mediator.publish('level-set-grid', grid: not @surface.gridShowing())
|
key 'g', => Backbone.Mediator.publish('level-set-grid', grid: not @surface.gridShowing())
|
||||||
|
|
||||||
|
preventBodyScrollingInThangList: (e) ->
|
||||||
|
@scrollTop += (if e.deltaY < 0 then 1 else -1) * 30
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
onLevelLoaded: (e) ->
|
onLevelLoaded: (e) ->
|
||||||
@level = e.level
|
@level = e.level
|
||||||
return if @startsLoading
|
return if @startsLoading
|
||||||
|
|
Loading…
Reference in a new issue