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