main
Last change
on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago |
Pred finalna verzija
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | import Konva from "konva";
|
---|
2 | import MapShape from "../base/MapShape.js";
|
---|
3 | import { _registerNode } from "konva/lib/Global";
|
---|
4 | export default class Room extends MapShape {
|
---|
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")
|
---|
13 | super(
|
---|
14 | {
|
---|
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)",
|
---|
20 | stroke: "grey",
|
---|
21 | strokeWidth: 1,
|
---|
22 | name: "mapObj",
|
---|
23 | rotation: attrs.rotation,
|
---|
24 | draggable: true,
|
---|
25 | },
|
---|
26 | attrs.layer,
|
---|
27 | attrs.blockSize,
|
---|
28 | attrs.snap
|
---|
29 | );
|
---|
30 |
|
---|
31 | this.floorNum = attrs.floorNum;
|
---|
32 |
|
---|
33 | this._info = {
|
---|
34 | name: `Room${id} [${this.floorNum}F]`,
|
---|
35 | type: "",
|
---|
36 | description: "",
|
---|
37 | };
|
---|
38 |
|
---|
39 | this.type = "Room";
|
---|
40 | this.eventName = "openRoomModalEvent";
|
---|
41 | this.id = id;
|
---|
42 |
|
---|
43 | this.initText();
|
---|
44 | }
|
---|
45 |
|
---|
46 | loadInfo(attrs) {
|
---|
47 | this.info.name = attrs.obj_name;
|
---|
48 | this.info.type = attrs.room_type;
|
---|
49 | this.info.description = attrs.description;
|
---|
50 | this.floorNum = attrs.floor_num;
|
---|
51 | }
|
---|
52 |
|
---|
53 | saveShapeDetails() {
|
---|
54 | this.setAttr("obj_name", this.info.name);
|
---|
55 | this.setAttr("room_type", this.info.type);
|
---|
56 | this.setAttr("description", this.info.description);
|
---|
57 | this.setAttr("floor_num",this.floorNum);
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | Room.prototype.className = "Room";
|
---|
62 | _registerNode(Room);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.