This commit is contained in:
syuilo 2019-08-19 16:05:57 +09:00
parent 4ecd2bffb7
commit 8712753eda
3 changed files with 31 additions and 2 deletions

View file

@ -2300,6 +2300,8 @@ room:
exit: "戻る"
remove: "しまう"
save: "保存"
clear: "片付け"
clear-confirm: "全ての家具をしまいますか?"
chooseImage: "画像を選択"
room-type: "部屋のタイプ"
carpet-color: "床の色"

View file

@ -696,6 +696,21 @@ export class Room {
this.onChangeSelect(null);
}
/**
*
*/
@autobind
public removeAllFurnitures() {
this.exitTransformMode();
for (const obj of this.objects) {
this.scene.remove(obj);
}
this.objects = [];
this.furnitures = [];
this.selectedObject = null;
this.onChangeSelect(null);
}
/**
*
* @param color

View file

@ -43,6 +43,7 @@
</section>
<section>
<ui-button primary @click="save()"><fa :icon="faSave"/> {{ $t('save') }}</ui-button>
<ui-button primary @click="clear()"><fa :icon="faBroom"/> {{ $t('clear') }}</ui-button>
</section>
</div>
</div>
@ -55,7 +56,7 @@ import { Room } from '../../../scripts/room/room';
import parseAcct from '../../../../../../misc/acct/parse';
import XPreview from './preview.vue';
const storeItems = require('../../../scripts/room/furnitures.json5');
import { faBoxOpen, faUndo, faArrowsAlt, faBan } from '@fortawesome/free-solid-svg-icons';
import { faBoxOpen, faUndo, faArrowsAlt, faBan, faBroom } from '@fortawesome/free-solid-svg-icons';
import { faSave, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
import { query as urlQuery } from '../../../../../../prelude/url';
@ -86,7 +87,7 @@ export default Vue.extend({
isTranslateMode: false,
isRotateMode: false,
isMyRoom: false,
faBoxOpen, faSave, faTrashAlt, faUndo, faArrowsAlt, faBan,
faBoxOpen, faSave, faTrashAlt, faUndo, faArrowsAlt, faBan, faBroom,
};
},
@ -156,6 +157,17 @@ export default Vue.extend({
});
},
clear() {
this.$root.dialog({
type: 'warning',
text: this.$t('clear-confirm'),
showCancelButton: true
}).then(({ canceled }) => {
if (canceled) return;
room.removeAllFurnitures();
});
},
chooseImage(key) {
this.$chooseDriveFile({
multiple: false