Skip to content
Snippets Groups Projects
Commit f38f4e37 authored by chrisgarrity's avatar chrisgarrity
Browse files

Found some more places that hardcoded costume name

parent 5dddcf11
No related branches found
No related tags found
No related merge requests found
......@@ -195,7 +195,8 @@ class CostumeTab extends React.Component {
}
handleCameraBuffer (buffer) {
const storage = this.props.vm.runtime.storage;
costumeUpload(buffer, 'image/png', 'costume1', storage, this.handleNewCostume);
const name = this.props.intl.formatMessage(messages.costume, {index: 1});
costumeUpload(buffer, 'image/png', name, storage, this.handleNewCostume);
}
handleFileUploadClick () {
this.fileInput.click();
......
......@@ -132,8 +132,9 @@ class TargetPane extends React.Component {
}
handleSpriteUpload (e) {
const storage = this.props.vm.runtime.storage;
const costumeSuffix = this.props.intl.formatMessage(sharedMessages.costume, {index: 1});
handleFileUpload(e.target, (buffer, fileType, fileName) => {
spriteUpload(buffer, fileType, fileName, storage, this.handleNewSprite);
spriteUpload(buffer, fileType, fileName, storage, this.handleNewSprite, costumeSuffix);
});
}
setFileInput (input) {
......
......@@ -180,7 +180,8 @@ const soundUpload = function (fileData, fileType, soundName, storage, handleSoun
handleSound(vmSound);
};
const spriteUpload = function (fileData, fileType, spriteName, storage, handleSprite) {
const spriteUpload = function (fileData, fileType, spriteName, storage, handleSprite, costumeSuffix) {
const costumeName = costumeSuffix || 'costume1';
switch (fileType) {
case '':
case 'application/zip': { // We think this is a .sprite2 or .sprite3 file
......@@ -191,7 +192,7 @@ const spriteUpload = function (fileData, fileType, spriteName, storage, handleSp
case 'image/png':
case 'image/jpeg': {
// Make a sprite from an image by making it a costume first
costumeUpload(fileData, fileType, `${spriteName}-costume1`, storage, (vmCostume => {
costumeUpload(fileData, fileType, `${spriteName}-${costumeName}`, storage, (vmCostume => {
const newSprite = {
name: spriteName,
isStage: false,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment