mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 05:53:39 -04:00
Enables moving around the map while an addThang is selected
This commit is contained in:
parent
d5d20377a2
commit
ed95206868
1 changed files with 2 additions and 2 deletions
|
@ -186,6 +186,7 @@ module.exports = class ThangsTabView extends View
|
|||
|
||||
onStageMouseUp: (e) ->
|
||||
if @addThangSprite
|
||||
@surface.camera.lock()
|
||||
# If we click on the background, we need to add @addThangSprite, but not if onSpriteMouseUp will fire.
|
||||
@backgroundAddClickTimeout = _.defer => @onExtantThangSelected {}
|
||||
$('#contextmenu').hide()
|
||||
|
@ -202,6 +203,7 @@ module.exports = class ThangsTabView extends View
|
|||
|
||||
onSpriteMouseUp: (e) ->
|
||||
clearTimeout @backgroundAddClickTimeout
|
||||
@surface.camera.unlock()
|
||||
if e.originalEvent.nativeEvent.button == 2 and @selectedExtantThang
|
||||
@onSpriteContextMenu e
|
||||
clearInterval(@movementInterval) if @movementInterval?
|
||||
|
@ -276,7 +278,6 @@ module.exports = class ThangsTabView extends View
|
|||
@surface.spriteBoss.removeSprite @addThangSprite if @addThangSprite
|
||||
@addThangType = type
|
||||
if @addThangType
|
||||
@surface.camera.lock()
|
||||
thang = @createAddThang()
|
||||
@addThangSprite = @surface.spriteBoss.addThangToSprites thang, @surface.spriteBoss.spriteLayers["Floating"]
|
||||
@addThangSprite.notOfThisWorld = true
|
||||
|
@ -285,7 +286,6 @@ module.exports = class ThangsTabView extends View
|
|||
pos ?= x: Math.round(@world.width / 2), y: Math.round(@world.height / 2)
|
||||
@adjustThangPos @addThangSprite, thang, pos
|
||||
else
|
||||
@surface.camera.unlock()
|
||||
@addThangSprite = null
|
||||
|
||||
createEssentialComponents: ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue