From 0713f6b2c310a71832d4e341d40a1172bd43bc99 Mon Sep 17 00:00:00 2001 From: cpirich Date: Mon, 22 Sep 2014 10:46:38 -0700 Subject: [PATCH] store sprite.value again, use it properly in setSpriteSize --- blockly/src/studio/studio.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/blockly/src/studio/studio.js b/blockly/src/studio/studio.js index cb767660eae61..25e5b23e6c71d 100644 --- a/blockly/src/studio/studio.js +++ b/blockly/src/studio/studio.js @@ -1793,12 +1793,15 @@ Studio.setSpriteSpeed = function (opts) { Studio.setSpriteSize = function (opts) { Studio.sprite[opts.spriteIndex].size = opts.value; + var curSpriteValue = Studio.sprite[opts.spriteIndex].value; - // call setSprite with existing index/value now that we changed the size - Studio.setSprite({ - spriteIndex: opts.spriteIndex, - value: Studio.sprite[opts.spriteIndex].value - }); + if (curSpriteValue !== 'hidden') { + // call setSprite with existing index/value now that we changed the size + Studio.setSprite({ + spriteIndex: opts.spriteIndex, + value: curSpriteValue + }); + } }; Studio.changeScore = function (opts) { @@ -1852,6 +1855,7 @@ Studio.setSprite = function (opts) { (skin[spriteValue].spriteHeight || Studio.DEFAULT_SPRITE_HEIGHT); sprite.width = sprite.size * (skin[spriteValue].spriteWidth || Studio.DEFAULT_SPRITE_WIDTH); + sprite.value = opts.forceHidden ? 'hidden' : opts.value; var spriteClipRect = document.getElementById('spriteClipRect' + spriteIndex); spriteClipRect.setAttribute('width', sprite.width);