Fixes 1647. Somehow had been under the impression the segmented sprite containers weren't handling clicks correctly and that segments needed to handle them.

This commit is contained in:
Scott Erickson 2014-10-21 14:27:37 -07:00
parent 103418fe2b
commit 20595b50da
2 changed files with 0 additions and 22 deletions

View file

@ -89,7 +89,6 @@ module.exports = class SegmentedSprite extends createjs.SpriteContainer
containerName = @spriteSheetPrefix + action.container
sprite = new createjs.Sprite(@spriteSheet)
sprite.gotoAndStop(containerName)
@listenToEventsFor(sprite)
if sprite.currentFrame is 0 or @usePlaceholders
sprite.gotoAndStop(0)
@notifyActionNeedsRender(action)
@ -173,7 +172,6 @@ module.exports = class SegmentedSprite extends createjs.SpriteContainer
outerContainer = new createjs.SpriteContainer(@spriteSheet)
innerContainer = new createjs.Sprite(@spriteSheet)
innerContainer.gotoAndStop(@spriteSheetPrefix + localContainer.gn)
@listenToEventsFor(innerContainer)
if innerContainer.currentFrame is 0 or @usePlaceholders
innerContainer.gotoAndStop(0)
@actionNotSupported = true
@ -191,12 +189,6 @@ module.exports = class SegmentedSprite extends createjs.SpriteContainer
map[localContainer.bn] = outerContainer
return map
listenToEventsFor: (displayObject) ->
for event in ['mousedown', 'click', 'dblclick', 'pressmove', 'pressup']
displayObject.on event, @onMouseEvent, @
onMouseEvent: (e) -> @dispatchEvent(e)
buildMovieClipAnimations: (localAnimations) ->
map = {}
for localAnimation in localAnimations

View file

@ -81,13 +81,6 @@ describe 'SegmentedSprite', ->
expect(hitRate).toBeGreaterThan(0.73)
$('canvas').remove()
it 'propagates events from the single segment through the segmented sprite', ->
fired = {}
segmentedSprite.on('click', -> fired.didIt = true)
segmentedSprite.gotoAndStop('idle')
segmentedSprite.children[0].dispatchEvent('click')
expect(fired.didIt).toBe(true)
describe 'with Ogre Munchkin ThangType', ->
beforeEach ->
layer = new LayerAdapter({webGL:true, name:'Default'})
@ -182,13 +175,6 @@ describe 'SegmentedSprite', ->
expect(hitRate).toBeGreaterThan(0.96)
$('canvas').remove()
it 'propagates events from the segments through the segmented sprite', ->
fired = {}
segmentedSprite.on('click', -> fired.didIt = true)
segmentedSprite.gotoAndStop('idle')
segmentedSprite.children[0].children[0].dispatchEvent('click')
expect(fired.didIt).toBe(true)
describe 'with Ogre Fangrider ThangType', ->
beforeEach ->
layer = new LayerAdapter({webGL:true})