This commit is contained in:
syuilo 2019-08-19 16:05:57 +09:00
parent 01e692b353
commit 311a4f28b0
3 changed files with 31 additions and 2 deletions

View File

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

View File

@ -696,6 +696,21 @@ export class Room {
this.onChangeSelect(null); 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 * @param color

View File

@ -43,6 +43,7 @@
</section> </section>
<section> <section>
<ui-button primary @click="save()"><fa :icon="faSave"/> {{ $t('save') }}</ui-button> <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> </section>
</div> </div>
</div> </div>
@ -55,7 +56,7 @@ import { Room } from '../../../scripts/room/room';
import parseAcct from '../../../../../../misc/acct/parse'; import parseAcct from '../../../../../../misc/acct/parse';
import XPreview from './preview.vue'; import XPreview from './preview.vue';
const storeItems = require('../../../scripts/room/furnitures.json5'); 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 { faSave, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
import { query as urlQuery } from '../../../../../../prelude/url'; import { query as urlQuery } from '../../../../../../prelude/url';
@ -86,7 +87,7 @@ export default Vue.extend({
isTranslateMode: false, isTranslateMode: false,
isRotateMode: false, isRotateMode: false,
isMyRoom: 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) { chooseImage(key) {
this.$chooseDriveFile({ this.$chooseDriveFile({
multiple: false multiple: false