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