diff --git a/app/lib/surface/Camera.coffee b/app/lib/surface/Camera.coffee index 891a1c4aa..80817afb4 100644 --- a/app/lib/surface/Camera.coffee +++ b/app/lib/surface/Camera.coffee @@ -174,12 +174,12 @@ module.exports = class Camera extends CocoClass @zoomTo target, newZoom, 0 onMouseDown: (e) -> - return unless e.canvas is @canvas + return unless e.canvas is @canvas[0] return if @dragDisabled @lastPos = {x: e.originalEvent.rawX, y: e.originalEvent.rawY} onMouseDragged: (e) -> - return unless e.canvas is @canvas + return unless e.canvas is @canvas[0] return if @dragDisabled target = @boundTarget(@target, @zoom) newPos = diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index b906b2d97..882383b97 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -501,7 +501,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass return if @letterboxOn p = @imageObject p = p.parent while p.parent - newEvent = sprite: @, thang: @thang, originalEvent: e, canvas:p + newEvent = sprite: @, thang: @thang, originalEvent: e, canvas:p.canvas @trigger ourEventName, newEvent Backbone.Mediator.publish ourEventName, newEvent diff --git a/app/lib/surface/Surface.coffee b/app/lib/surface/Surface.coffee index beb223045..e324cf742 100644 --- a/app/lib/surface/Surface.coffee +++ b/app/lib/surface/Surface.coffee @@ -417,7 +417,7 @@ module.exports = Surface = class Surface extends CocoClass @stage.enableMouseOver(10) @stage.addEventListener 'stagemousemove', @onMouseMove @stage.addEventListener 'stagemousedown', @onMouseDown - @stage.addEventListener 'stagemouseup', @onMouseUp + @canvas[0].addEventListener 'mouseup', @onMouseUp @canvas.on 'mousewheel', @onMouseWheel @hookUpChooseControls() if @options.choosing createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED diff --git a/app/styles/editor/level/components_tab.sass b/app/styles/editor/level/components_tab.sass index 2903a25e3..2e118a1e3 100644 --- a/app/styles/editor/level/components_tab.sass +++ b/app/styles/editor/level/components_tab.sass @@ -15,18 +15,23 @@ top: 0 bottom: 0 - .treema-root - position: absolute - top: 35px - bottom: 0 + .editor-nano-container + position: relative + height: 90% width: 250px - overflow: scroll - - .treema-children .treema-row * - cursor: pointer !important + + .treema-root + position: absolute + bottom: 0 + width: 250px + overflow: scroll - #components-treema - z-index: 11 + .treema-children .treema-row * + cursor: pointer !important + .nano-pane + z-index: 12 + #components-treema + z-index: 11 .edit-component-container margin-left: 290px diff --git a/app/styles/editor/level/edit.sass b/app/styles/editor/level/edit.sass index 09bb03fe0..a234ddd58 100644 --- a/app/styles/editor/level/edit.sass +++ b/app/styles/editor/level/edit.sass @@ -142,3 +142,10 @@ .treema-root background-color: white border-radius: 4px + + .editor-nano-container + position: static + + .nano-content + outline: thin + diff --git a/app/styles/editor/level/scripts_tab.sass b/app/styles/editor/level/scripts_tab.sass index a74bacdfa..52c3f031e 100644 --- a/app/styles/editor/level/scripts_tab.sass +++ b/app/styles/editor/level/scripts_tab.sass @@ -8,22 +8,23 @@ .treema-script cursor: pointer - - #scripts-treema - position: absolute - top: 0 - bottom: 0 - width: 250px - overflow: scroll - @media screen and (max-width: 800px) - top: 40px - z-index: 11 - - #script-treema - margin-left: 290px - max-height: 100% - overflow: scroll - box-sizing: border-box - @media screen and (max-width: 800px) - margin-left: 30px - top: -50px + + .editor-nano-container + #scripts-treema + position: absolute + top: 0 + bottom: 0 + width: 250px + overflow: scroll + @media screen and (max-width: 800px) + top: 40px + z-index: 11 + + #script-treema + margin-left: 290px + max-height: 100% + overflow: scroll + box-sizing: border-box + @media screen and (max-width: 800px) + margin-left: 30px + top: -50px diff --git a/app/styles/editor/level/systems_tab.sass b/app/styles/editor/level/systems_tab.sass index c74f79be9..594050534 100644 --- a/app/styles/editor/level/systems_tab.sass +++ b/app/styles/editor/level/systems_tab.sass @@ -15,9 +15,13 @@ top: 0 bottom: 40px + .editor-nano-container + position: relative + height: 90% + width: 250px + .treema-root position: absolute - top: 35px bottom: 0 width: 250px overflow: scroll diff --git a/app/styles/editor/level/thangs_tab.sass b/app/styles/editor/level/thangs_tab.sass index e37db3036..5fe9e2f10 100644 --- a/app/styles/editor/level/thangs_tab.sass +++ b/app/styles/editor/level/thangs_tab.sass @@ -68,14 +68,20 @@ $mobile: 1050px h3 margin: 0 -20px 0 0 + .editor-nano-container + height: 90% + position: relative + top: 20px #thangs-treema + height: 100% + width: 100% position: absolute - top: 80px left: 0 right: 0 bottom: 0 overflow: scroll margin: 0 + outline: thin @media screen and (max-width: $mobile) margin: 5px top: 40px @@ -148,6 +154,9 @@ $mobile: 1050px @media screen and (max-width: $mobile) margin: 0 5px + #thangs-list-container + height: 90% + #thangs-list position: relative right: 0 diff --git a/app/templates/editor/level/add_thangs.jade b/app/templates/editor/level/add_thangs.jade index 5b2419072..fe9fbba39 100644 --- a/app/templates/editor/level/add_thangs.jade +++ b/app/templates/editor/level/add_thangs.jade @@ -1,10 +1,11 @@ h3(data-i18n="editor.level_tab_thangs_add") Add Thangs input(type="search", id="thang-search") -#thangs-list - for group in groups - h4= group.name - for thangType in group.thangs - div.add-thang-palette-icon(data-thang-type=thangType.name) - - path = '/file/db/thang.type/'+thangType.original+'/portrait.png' - img(title="Add " + thangType.name, src=path, alt="") - div.clearfix \ No newline at end of file +div.editor-nano-container.nano + #thangs-list.nano-content + for group in groups + h4= group.name + for thangType in group.thangs + div.add-thang-palette-icon(data-thang-type=thangType.name) + - path = '/file/db/thang.type/'+thangType.original+'/portrait.png' + img(title="Add " + thangType.name, src=path, alt="") + div.clearfix \ No newline at end of file diff --git a/app/templates/editor/level/components_tab.jade b/app/templates/editor/level/components_tab.jade index 3d62ca0ce..d457ade2a 100644 --- a/app/templates/editor/level/components_tab.jade +++ b/app/templates/editor/level/components_tab.jade @@ -2,7 +2,8 @@ h3(data-i18n="editor.level_component_tab_title") Current Components button.navbar-toggle.toggle.btn-primary(type="button" data-toggle="collapse" data-target="#components-treema") span.icon-list - #components-treema + .editor-nano-container.nano + #components-treema.nano-content .edit-component-container if me.isAdmin() diff --git a/app/templates/editor/level/scripts_tab.jade b/app/templates/editor/level/scripts_tab.jade index b3b074f17..5bc5610ec 100644 --- a/app/templates/editor/level/scripts_tab.jade +++ b/app/templates/editor/level/scripts_tab.jade @@ -1,6 +1,8 @@ button.navbar-toggle.toggle.btn-primary(type="button", data-toggle="collapse", data-target="#scripts-treema") span.icon-list -#scripts-treema +.editor-nano-container.nano + #scripts-treema.nano-content -#script-treema +.editor-nano-container.nano + #script-treema.nano-content diff --git a/app/templates/editor/level/settings_tab.jade b/app/templates/editor/level/settings_tab.jade index ad77d234d..3c015e6cf 100644 --- a/app/templates/editor/level/settings_tab.jade +++ b/app/templates/editor/level/settings_tab.jade @@ -1 +1,2 @@ -#settings-treema +.editor-nano-container.nano + #settings-treema.nano-content diff --git a/app/templates/editor/level/systems_tab.jade b/app/templates/editor/level/systems_tab.jade index 8cb062bac..bba7b57d8 100644 --- a/app/templates/editor/level/systems_tab.jade +++ b/app/templates/editor/level/systems_tab.jade @@ -2,7 +2,8 @@ button.navbar-toggle.toggle.btn-primary(type="button" data-toggle="collapse" data-target="#systems-treema") span.icon-list h3(data-i18n="editor.level_systems_tab_title") Current Systems - #systems-treema + .editor-nano-container.nano + #systems-treema.nano-content .edit-system-container if me.isAdmin() diff --git a/app/templates/editor/level/thangs_tab.jade b/app/templates/editor/level/thangs_tab.jade index 1ff12bc12..e76a0f0d9 100644 --- a/app/templates/editor/level/thangs_tab.jade +++ b/app/templates/editor/level/thangs_tab.jade @@ -17,7 +17,8 @@ button.navbar-toggle.toggle.btn-primary#thangs-palette-toggle(type="button", dat i.icon-leaf button.btn.btn-primary(value="Misc", title="Misc") i.icon-question-sign - #thangs-treema(title="Double click to configure a thang") + .editor-nano-container.nano + #thangs-treema.nano-content(title="Double click to configure a thang") .world-container.thangs-column h3(data-i18n="editor.level_tab_thangs_conditions") Starting Conditions diff --git a/app/views/editor/level/edit.coffee b/app/views/editor/level/edit.coffee index c97be9459..1b19e68b2 100644 --- a/app/views/editor/level/edit.coffee +++ b/app/views/editor/level/edit.coffee @@ -113,6 +113,7 @@ module.exports = class EditorLevelView extends View button.find('> span').toggleClass('secret') toggleTab: (e) -> + @renderScrollbar() return unless $(document).width() <= 800 li = $(e.target).closest('li') if li.hasClass('active') diff --git a/app/views/editor/level/thangs_tab_view.coffee b/app/views/editor/level/thangs_tab_view.coffee index 0e0ac9a74..5d5cdd7b3 100644 --- a/app/views/editor/level/thangs_tab_view.coffee +++ b/app/views/editor/level/thangs_tab_view.coffee @@ -250,7 +250,7 @@ module.exports = class ThangsTabView extends View # @thangsTreema.deselectAll() selectAddThang: (e) => - return unless e? and $(e.target).closest('#editor-level-thangs-tab-view').length + return unless e? and $(e.target).closest('#editor-level-thangs-tab-view').length or key.isPressed('esc') if e then target = $(e.target) else target = @$el.find('.add-thangs-palette') # pretend to click on background if no event return true if target.attr('id') is 'surface' target = target.closest('.add-thang-palette-icon') diff --git a/app/views/kinds/CocoView.coffee b/app/views/kinds/CocoView.coffee index f5a69f5bf..96a0aac45 100644 --- a/app/views/kinds/CocoView.coffee +++ b/app/views/kinds/CocoView.coffee @@ -115,6 +115,11 @@ module.exports = class CocoView extends Backbone.View context afterRender: -> + @renderScrollbar() + + renderScrollbar: -> + #Defer the call till the content actually gets rendered, nanoscroller requires content to be visible + _.defer => @$el.find('.nano').nanoScroller() updateProgress: (progress) -> @loadProgress.progress = progress if progress > @loadProgress.progress diff --git a/app/views/kinds/RootView.coffee b/app/views/kinds/RootView.coffee index 09d50575b..3350dc48e 100644 --- a/app/views/kinds/RootView.coffee +++ b/app/views/kinds/RootView.coffee @@ -35,10 +35,6 @@ module.exports = class RootView extends CocoView $el ?= @$el.find('.main-content-area') super($el) - renderScrollbar: -> - $('.nano-pane').css('display','none') - $ -> $('.nano').nanoScroller() - afterInsert: -> # force the browser to scroll to the hash # also messes with the browser history, so perhaps come up with a better solution