diff --git a/app/views/game-menu/InventoryView.coffee b/app/views/game-menu/InventoryView.coffee index 7cc04ed7b..0c710deb2 100644 --- a/app/views/game-menu/InventoryView.coffee +++ b/app/views/game-menu/InventoryView.coffee @@ -16,7 +16,9 @@ module.exports = class InventoryView extends CocoView 'click .item-slot': 'onItemSlotClick' 'click #available-equipment .list-group-item:not(.equipped)': 'onAvailableItemClick' 'dblclick #available-equipment .list-group-item:not(.equipped)': 'onAvailableItemDoubleClick' + 'doubletap #available-equipment .list-group-item:not(.equipped)': 'onAvailableItemDoubleClick' 'dblclick .item-slot .item-view': 'onEquippedItemDoubleClick' + 'doubletap .item-slot .item-view': 'onEquippedItemDoubleClick' subscriptions: 'level:hero-selection-updated': 'onHeroSelectionUpdated' diff --git a/app/views/play/level/LevelPlaybackView.coffee b/app/views/play/level/LevelPlaybackView.coffee index ad93ac0a3..81bf36555 100644 --- a/app/views/play/level/LevelPlaybackView.coffee +++ b/app/views/play/level/LevelPlaybackView.coffee @@ -41,6 +41,9 @@ module.exports = class LevelPlaybackView extends CocoView 'mouseenter #timeProgress': 'onProgressEnter' 'mouseleave #timeProgress': 'onProgressLeave' 'mousemove #timeProgress': 'onProgressHover' + 'tapstart #timeProgress': 'onProgressTapStart' + 'tapend #timeProgress': 'onProgressTapEnd' + 'tapmove #timeProgress': 'onProgressTapMove' shortcuts: '⌘+p, p, ctrl+p': 'onTogglePlay' @@ -276,9 +279,9 @@ module.exports = class LevelPlaybackView extends CocoView onProgressLeave: (e) -> @timePopup?.leave @timePopup - onProgressHover: (e) -> + onProgressHover: (e, offsetX) -> timeRatio = @$progressScrubber.width() / @totalTime - offsetX = e.clientX - $(e.target).closest('#timeProgress').offset().left + offsetX ?= e.clientX - $(e.target).closest('#timeProgress').offset().left @newTime = offsetX / timeRatio @updatePopupContent() @timePopup?.onHover e @@ -287,6 +290,27 @@ module.exports = class LevelPlaybackView extends CocoView if @timePopup and Math.abs(@currentTime - @newTime) < 1 and not @timePopup.shown @timePopup.show() + onProgressTapStart: (e, touchData) -> + return unless application.isIPadApp + @onProgressEnter e + screenOffsetX = e.clientX ? touchData?.position.x ? 0 + offsetX = screenOffsetX - $(e.target).closest('#timeProgress').offset().left + offsetX = Math.max offsetX, 0 + @scrubTo offsetX / @$progressScrubber.width() + @onTogglePlay() if @$el.find('#play-button').hasClass 'playing' + + onProgressTapEnd: (e, touchData) -> + return unless application.isIPadApp + @onProgressLeave e + + onProgressTapMove: (e, touchData) -> + return unless application.isIPadApp # Not sure why the tap events would fire when it's not one. + screenOffsetX = e.clientX ? touchData?.position.x ? 0 + offsetX = screenOffsetX - $(e.target).closest('#timeProgress').offset().left + offsetX = Math.max offsetX, 0 + @onProgressHover e, offsetX + @scrubTo offsetX / @$progressScrubber.width() + updateProgress: (progress, world) -> if world.frames.length isnt @lastLoadedFrameCount @updateBarWidth world.frames.length, world.maxTotalFrames, world.dt diff --git a/config.coffee b/config.coffee index b9b50867d..f12be32cb 100644 --- a/config.coffee +++ b/config.coffee @@ -64,6 +64,7 @@ exports.config = 'bower_components/fastclick/lib/fastclick.js' 'bower_components/d3/d3.min.js' 'vendor/scripts/async.js' + 'vendor/scripts/jquery-ui-1.11.1.js.custom.js' ] stylesheets: defaultExtension: 'sass'