Update gui to use getter for target costumes

This commit is contained in:
DD committed 2018-02-22 10:13:54 -05:00
1 parent fc388b63c8
commit 45bcab02fb
2 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -77,7 +77,7 @@ class CostumeTab extends React.Component {
}
handleNewCostume () {
if (!this.props.vm.editingTarget) return;
const costumes = this.props.vm.editingTarget.sprite.costumes || [];
const costumes = this.props.vm.editingTarget.getCostumes() || [];
this.setState({selectedCostumeIndex: Math.max(costumes.length - 1, 0)});
}
handleNewBlankCostume () {
+4 -4
View File
@@ -36,15 +36,15 @@ export default function (vm) {
};
const costumesMenu = function () {
if (vm.editingTarget && vm.editingTarget.sprite.costumes.length > 0) {
return vm.editingTarget.sprite.costumes.map(costume => [costume.name, costume.name]);
if (vm.editingTarget && vm.editingTarget.getCostumes().length > 0) {
return vm.editingTarget.getCostumes().map(costume => [costume.name, costume.name]);
}
return [['', '']];
};
const backdropsMenu = function () {
if (vm.runtime.targets[0] && vm.runtime.targets[0].sprite.costumes.length > 0) {
return vm.runtime.targets[0].sprite.costumes.map(costume => [costume.name, costume.name])
if (vm.runtime.targets[0] && vm.runtime.targets[0].getCostumes().length > 0) {
return vm.runtime.targets[0].getCostumes().map(costume => [costume.name, costume.name])
.concat([['next backdrop', 'next backdrop'], ['previous backdrop', 'previous backdrop']]);
}
return [['', '']];