Changeset 0c6b92a for imaps-frontend/src/scripts/shapes/Room.js
- Timestamp:
- 12/12/24 17:06:06 (5 weeks ago)
- Branches:
- main
- Parents:
- d565449
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/src/scripts/shapes/Room.js
rd565449 r0c6b92a 1 1 import Konva from "konva"; 2 import MapShape from ". /MapShape";2 import MapShape from "../base/MapShape.js"; 3 3 import { _registerNode } from "konva/lib/Global"; 4 4 export default class Room extends MapShape { 5 constructor(mousePos, blockSize, layer, rotation, snap, id, scaleX = 1, scaleY = 1){ 5 constructor(attrs,id){ 6 7 if(!attrs.fromLoad){ 8 attrs.width *= 12; 9 attrs.height *= 8; 10 } 11 12 console.log(attrs.position,"hehe") 6 13 super( 7 14 { 8 x: mousePos.x,9 y: mousePos.y,10 width: blockSize * 8 *scaleX,11 height: blockSize * 4 *scaleY,12 fill: " #DDE0F8",15 x: attrs.position.x, 16 y: attrs.position.y, 17 width: attrs.width * attrs.scaleX, 18 height: attrs.height * attrs.scaleY, 19 fill: "rgb(86,168,253)", 13 20 stroke: "grey", 14 21 strokeWidth: 1, 15 22 name: "mapObj", 16 rotation: rotation,23 rotation: attrs.rotation, 17 24 draggable: true, 18 25 }, 19 layer,20 blockSize,21 snap26 attrs.layer, 27 attrs.blockSize, 28 attrs.snap 22 29 ); 23 30 31 this.floorNum = attrs.floorNum; 32 24 33 this._info = { 25 name: `Room ${id}`,34 name: `Room${id} [${this.floorNum}F]`, 26 35 type: "", 27 36 description: "", … … 29 38 30 39 this.type = "Room"; 31 this. modalEventName = "openRoomModalEvent";40 this.eventName = "openRoomModalEvent"; 32 41 this.id = id; 33 42 … … 39 48 this.info.type = attrs.room_type; 40 49 this.info.description = attrs.description; 50 this.floorNum = attrs.floor_num; 41 51 } 42 52 … … 45 55 this.setAttr("room_type", this.info.type); 46 56 this.setAttr("description", this.info.description); 57 this.setAttr("floor_num",this.floorNum); 47 58 } 48 59 }
Note:
See TracChangeset
for help on using the changeset viewer.