Merge pull request #282 from paulkaplan/fix-costume-backdrop-loading

Fix backdrop and costume loading from libraries
This commit is contained in:
Paul Kaplan authored and GitHub committed 2017-03-31 12:52:14 -04:00
commit d0f8d9a990
2 files changed
+8 -12

No files matched your search

+4 -6
View File
@@ -15,15 +15,13 @@ class BackdropLibrary extends React.Component {
}
handleItemSelect (item) {
const vmBackdrop = {
skin: `https://cdn.assets.scratch.mit.edu/internalapi/asset/${item.md5}/get/`,
name: item.name,
rotationCenterX: item.info[0] && item.info[0] / 2,
rotationCenterY: item.info[1] && item.info[1] / 2
rotationCenterY: item.info[1] && item.info[1] / 2,
bitmapResolution: item.info.length > 2 ? item.info[2] : 1,
skinId: null
};
if (item.info.length > 2) {
vmBackdrop.bitmapResolution = item.info[2];
}
this.props.vm.addBackdrop(vmBackdrop);
this.props.vm.addBackdrop(item.md5, vmBackdrop);
}
render () {
return (
+4 -6
View File
@@ -15,15 +15,13 @@ class CostumeLibrary extends React.Component {
}
handleItemSelected (item) {
const vmCostume = {
skin: `https://cdn.assets.scratch.mit.edu/internalapi/asset/${item.md5}/get/`,
name: item.name,
rotationCenterX: item.info[0],
rotationCenterY: item.info[1]
rotationCenterY: item.info[1],
bitmapResolution: item.info.length > 2 ? item.info[2] : 1,
skinId: null
};
if (item.info.length > 2) {
vmCostume.bitmapResolution = item.info[2];
}
this.props.vm.addCostume(vmCostume);
this.props.vm.addCostume(item.md5, vmCostume);
}
render () {
return (