diff --git a/src/containers/sprite-library.jsx b/src/containers/sprite-library.jsx index 072e1714a81ca1683acb86e9d280bef47c322156..15d75970c1b9123373d37e7c93d3a4aa20fe4c4c 100644 --- a/src/containers/sprite-library.jsx +++ b/src/containers/sprite-library.jsx @@ -39,7 +39,7 @@ class SpriteLibrary extends React.PureComponent { clearInterval(this.intervalId); } handleItemSelect (item) { - this.props.vm.addSprite2(JSON.stringify(item.json)); + this.props.vm.addSprite(JSON.stringify(item.json)); analytics.event({ category: 'library', action: 'Select Sprite', diff --git a/src/containers/target-pane.jsx b/src/containers/target-pane.jsx index 535e4b270a19111bdea51874511672cb28244074..1178ed64ec9d7fc10eb6d07afe1fcba16a535ffb 100644 --- a/src/containers/target-pane.jsx +++ b/src/containers/target-pane.jsx @@ -72,13 +72,13 @@ class TargetPane extends React.Component { } handleSurpriseSpriteClick () { const item = spriteLibraryContent[Math.floor(Math.random() * spriteLibraryContent.length)]; - this.props.vm.addSprite2(JSON.stringify(item.json)); + this.props.vm.addSprite(JSON.stringify(item.json)); } handlePaintSpriteClick () { // @todo this is brittle, will need to be refactored for localized libraries const emptyItem = spriteLibraryContent.find(item => item.name === 'Empty'); if (emptyItem) { - this.props.vm.addSprite2(JSON.stringify(emptyItem.json)).then(() => { + this.props.vm.addSprite(JSON.stringify(emptyItem.json)).then(() => { setTimeout(() => { // Wait for targets update to propagate before tab switching this.props.onActivateTab(COSTUMES_TAB_INDEX); }); @@ -86,7 +86,7 @@ class TargetPane extends React.Component { } } handleNewSprite (spriteJSONString) { - this.props.vm.addSprite(spriteJSONString); // TODO change all instances of addSprite2 to addSprite? + this.props.vm.addSprite(spriteJSONString); } handleFileUploadClick () { this.fileInput.click(); diff --git a/src/lib/file-uploader.js b/src/lib/file-uploader.js index cfe54784b329774b0e92d44b9477b3c16e808ee9..a431774c5ec32f1e0f6f0f51bc03f6e51df0bcf7 100644 --- a/src/lib/file-uploader.js +++ b/src/lib/file-uploader.js @@ -189,24 +189,20 @@ const spriteUpload = function (fileData, fileType, spriteName, storage, handleSp // let costume = null; costumeUpload(fileData, fileType, `${spriteName}-costume1`, storage, (vmCostume => { const newSprite = { - targets: [{ - name: spriteName, - isStage: false, - x: 0, // what should we put here... - y: 0, - visible: true, - size: 100, - rotationStyle: 'all around', - direction: 90, - draggable: true, - currentCostume: 0, - blocks: {}, - variables: {}, - lists: {}, - broadcasts: {}, - costumes: [vmCostume], - sounds: [] // TODO are all of these necessary? - }] + name: spriteName, + isStage: false, + x: 0, + y: 0, + visible: true, + size: 100, + rotationStyle: 'all around', + direction: 90, + draggable: true, + currentCostume: 0, + blocks: {}, + variables: {}, + costumes: [vmCostume], + sounds: [] // TODO are all of these necessary? }; // TODO probably just want sprite upload to handle this object directly handleSprite(JSON.stringify(newSprite));