source: imaps-frontend/src/scripts/shapes/Entrance.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[d565449]1import Konva from "konva";
2import MapShape from "./MapShape";
3import { _registerNode } from "konva/lib/Global";
4export default class Entrance 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 * scaleX,
11 height: blockSize * 2 * scaleY,
12 fill: "#0051ff",
13 stroke: "grey",
14 strokeWidth: 1,
15 opacity: 0.7,
16 name: "mapObj",
17 draggable: true,
18 rotation: rotation,
19 zIndex: 1,
20 },
21 layer,
22 blockSize,
23 snap
24 );
25 this.type = "Entrance";
26 this.modalEventName = "openEntranceModalEvent";
27
28 this.id = id;
29
30 this._info = {
31 name: `Entrance ${id}`,
32 connectedRoom: "",
33 description: "",
34 isMainEntrance: false,
35 selectedPin: "",
36 selectedPins: [],
37 };
38
39 this.initText();
40 }
41
42 loadInfo(attrs) {
43 this.info.name = attrs.obj_name;
44 this.info.connectedRoom = attrs.connected_room;
45 this.info.description = attrs.description;
46 this.info.isMainEntrance = attrs.is_main_entrance;
47 this.info.selectedPins = attrs.connected_pins;
48 }
49
50 saveShapeDetails() {
51 this.setAttr("connected_pins", this.info.selectedPins);
52 this.setAttr("obj_name", this.info.name);
53 this.setAttr("description", this.info.description);
54 this.setAttr("is_main_entrance", this.info.isMainEntrance);
55 this.setAttr("connected_room", this.info.connectedRoom);
56 }
57}
58
59Entrance.prototype.className = "Entrance";
60_registerNode(Entrance);
Note: See TracBrowser for help on using the repository browser.