This commit is contained in:
syuilo 2019-08-19 15:59:36 +09:00
parent 3b445af6fc
commit 01e692b353
1 changed files with 38 additions and 2 deletions

View File

@ -441,7 +441,7 @@ export class Room {
} }
@autobind @autobind
public applyCustomColor(model: THREE.Object3D) { private applyCustomColor(model: THREE.Object3D) {
const furniture = this.furnitures.find(furniture => furniture.id === model.name); const furniture = this.furnitures.find(furniture => furniture.id === model.name);
const def = furnitureDefs.find(d => d.id === furniture.type); const def = furnitureDefs.find(d => d.id === furniture.type);
if (def.color == null) return; if (def.color == null) return;
@ -465,7 +465,7 @@ export class Room {
} }
@autobind @autobind
public applyCustomTexture(model: THREE.Object3D) { private applyCustomTexture(model: THREE.Object3D) {
const furniture = this.furnitures.find(furniture => furniture.id === model.name); const furniture = this.furnitures.find(furniture => furniture.id === model.name);
const def = furnitureDefs.find(d => d.id === furniture.type); const def = furnitureDefs.find(d => d.id === furniture.type);
if (def.texture == null) return; if (def.texture == null) return;
@ -619,6 +619,10 @@ export class Room {
}); });
} }
/**
* /
* @param type
*/
@autobind @autobind
public enterTransformMode(type: 'translate' | 'rotate') { public enterTransformMode(type: 'translate' | 'rotate') {
this.isTransformMode = true; this.isTransformMode = true;
@ -626,12 +630,20 @@ export class Room {
this.furnitureControl.attach(this.selectedObject); this.furnitureControl.attach(this.selectedObject);
} }
/**
* /
*/
@autobind @autobind
public exitTransformMode() { public exitTransformMode() {
this.isTransformMode = false; this.isTransformMode = false;
this.furnitureControl.detach(); this.furnitureControl.detach();
} }
/**
*
* @param key
* @param value
*/
@autobind @autobind
public updateProp(key: string, value: any) { public updateProp(key: string, value: any) {
const furniture = this.furnitures.find(furniture => furniture.id === this.selectedObject.name); const furniture = this.furnitures.find(furniture => furniture.id === this.selectedObject.name);
@ -641,6 +653,10 @@ export class Room {
this.applyCustomTexture(this.selectedObject); this.applyCustomTexture(this.selectedObject);
} }
/**
*
* @param type
*/
@autobind @autobind
public addFurniture(type: string) { public addFurniture(type: string) {
const furniture = { const furniture = {
@ -666,6 +682,9 @@ export class Room {
}); });
} }
/**
*
*/
@autobind @autobind
public removeFurniture() { public removeFurniture() {
this.exitTransformMode(); this.exitTransformMode();
@ -677,12 +696,20 @@ export class Room {
this.onChangeSelect(null); this.onChangeSelect(null);
} }
/**
*
* @param color
*/
@autobind @autobind
public updateCarpetColor(color: string) { public updateCarpetColor(color: string) {
this.roomInfo.carpetColor = color; this.roomInfo.carpetColor = color;
this.applyCarpetColor(); this.applyCarpetColor();
} }
/**
*
* @param type
*/
@autobind @autobind
public changeRoomType(type: string) { public changeRoomType(type: string) {
this.roomInfo.roomType = type; this.roomInfo.roomType = type;
@ -690,6 +717,9 @@ export class Room {
this.loadRoom(); this.loadRoom();
} }
/**
*
*/
@autobind @autobind
public getRoomInfo() { public getRoomInfo() {
for (const obj of this.objects) { for (const obj of this.objects) {
@ -705,6 +735,9 @@ export class Room {
return this.roomInfo; return this.roomInfo;
} }
/**
*
*/
@autobind @autobind
public getSelectedObject() { public getSelectedObject() {
return this.selectedObject; return this.selectedObject;
@ -715,6 +748,9 @@ export class Room {
return this.furnitures.find(furniture => furniture.id === id); return this.furnitures.find(furniture => furniture.id === id);
} }
/**
*
*/
@autobind @autobind
public destroy() { public destroy() {
// Stop render loop // Stop render loop