main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[d565449] | 1 | import Konva from "konva";
|
---|
| 2 | import MapShape from "./MapShape";
|
---|
| 3 | import { _registerNode } from "konva/lib/Global";
|
---|
| 4 | export default class Room extends MapShape {
|
---|
| 5 | constructor(mousePos, blockSize, layer, rotation, snap, id, scaleX = 1, scaleY = 1){
|
---|
| 6 | super(
|
---|
| 7 | {
|
---|
| 8 | x: mousePos.x,
|
---|
| 9 | y: mousePos.y,
|
---|
| 10 | width: blockSize * 8 * scaleX,
|
---|
| 11 | height: blockSize * 4 * scaleY,
|
---|
| 12 | fill: "#DDE0F8",
|
---|
| 13 | stroke: "grey",
|
---|
| 14 | strokeWidth: 1,
|
---|
| 15 | name: "mapObj",
|
---|
| 16 | rotation: rotation,
|
---|
| 17 | draggable: true,
|
---|
| 18 | },
|
---|
| 19 | layer,
|
---|
| 20 | blockSize,
|
---|
| 21 | snap
|
---|
| 22 | );
|
---|
| 23 |
|
---|
| 24 | this._info = {
|
---|
| 25 | name: `Room ${id}`,
|
---|
| 26 | type: "",
|
---|
| 27 | description: "",
|
---|
| 28 | };
|
---|
| 29 |
|
---|
| 30 | this.type = "Room";
|
---|
| 31 | this.modalEventName = "openRoomModalEvent";
|
---|
| 32 | this.id = id;
|
---|
| 33 |
|
---|
| 34 | this.initText();
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | loadInfo(attrs) {
|
---|
| 38 | this.info.name = attrs.obj_name;
|
---|
| 39 | this.info.type = attrs.room_type;
|
---|
| 40 | this.info.description = attrs.description;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | saveShapeDetails() {
|
---|
| 44 | this.setAttr("obj_name", this.info.name);
|
---|
| 45 | this.setAttr("room_type", this.info.type);
|
---|
| 46 | this.setAttr("description", this.info.description);
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | Room.prototype.className = "Room";
|
---|
| 51 | _registerNode(Room);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.