From 311a4f28b066e35ad9b459f476272f74df996d46 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 19 Aug 2019 16:05:57 +0900 Subject: [PATCH] Resolve #5298 --- locales/ja-JP.yml | 2 ++ src/client/app/common/scripts/room/room.ts | 15 +++++++++++++++ src/client/app/common/views/pages/room/room.vue | 16 ++++++++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 166233a820..090753f52a 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2300,6 +2300,8 @@ room: exit: "戻る" remove: "しまう" save: "保存" + clear: "片付け" + clear-confirm: "全ての家具をしまいますか?" chooseImage: "画像を選択" room-type: "部屋のタイプ" carpet-color: "床の色" diff --git a/src/client/app/common/scripts/room/room.ts b/src/client/app/common/scripts/room/room.ts index d5df9a54e4..0205b1e1ce 100644 --- a/src/client/app/common/scripts/room/room.ts +++ b/src/client/app/common/scripts/room/room.ts @@ -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 色 diff --git a/src/client/app/common/views/pages/room/room.vue b/src/client/app/common/views/pages/room/room.vue index 7a365fe9ba..0a355f9ad1 100644 --- a/src/client/app/common/views/pages/room/room.vue +++ b/src/client/app/common/views/pages/room/room.vue @@ -43,6 +43,7 @@
{{ $t('save') }} + {{ $t('clear') }}
@@ -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