mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-13 22:49:51 -04:00
Clicking a thang in the left list automatically pans to the sprite on the editor map
This commit is contained in:
parent
d5a4b1f5ef
commit
91515b1cea
2 changed files with 5 additions and 5 deletions
|
@ -256,15 +256,15 @@ module.exports = class SpriteBoss extends CocoClass
|
|||
return if key.shift #and @options.choosing
|
||||
@selectSprite e if e.onBackground
|
||||
|
||||
selectThang: (thangID, spellName=null) ->
|
||||
selectThang: (thangID, spellName=null, treemaThangSelected = null) ->
|
||||
return @willSelectThang = [thangID, spellName] unless @sprites[thangID]
|
||||
@selectSprite null, @sprites[thangID], spellName
|
||||
@selectSprite null, @sprites[thangID], spellName, treemaThangSelected
|
||||
|
||||
selectSprite: (e, sprite=null, spellName=null) ->
|
||||
selectSprite: (e, sprite=null, spellName=null, treemaThangSelected = null) ->
|
||||
return if e and (@disabled or @selectLocked) # Ignore clicks for selection/panning/wizard movement while disabled or select is locked
|
||||
worldPos = sprite?.thang?.pos
|
||||
worldPos ?= @camera.canvasToWorld {x: e.originalEvent.rawX, y: e.originalEvent.rawY} if e
|
||||
if worldPos and (@options.navigateToSelection or not sprite)
|
||||
if worldPos and (@options.navigateToSelection or not sprite or treemaThangSelected)
|
||||
@camera.zoomTo(sprite?.displayObject or @camera.worldToSurface(worldPos), @camera.zoom, 1000)
|
||||
sprite = null if @options.choosing # Don't select sprites while choosing
|
||||
if sprite isnt @selectedSprite
|
||||
|
|
|
@ -360,7 +360,7 @@ module.exports = class ThangsTabView extends View
|
|||
onTreemaThangSelected: (e, selectedTreemas) =>
|
||||
selectedThangID = _.last(selectedTreemas)?.data.id
|
||||
if selectedThangID isnt @selectedExtantThang?.id
|
||||
@surface.spriteBoss.selectThang selectedThangID
|
||||
@surface.spriteBoss.selectThang selectedThangID, null, true
|
||||
|
||||
onTreemaThangDoubleClicked: (e, treema) =>
|
||||
id = treema?.data?.id
|
||||
|
|
Loading…
Reference in a new issue