1 | import RenderedMapShape from "../base/RenderedMapShape.js";
|
---|
2 | import {_registerNode} from "konva/lib/Global";
|
---|
3 |
|
---|
4 | export default class RenderedRoom extends RenderedMapShape {
|
---|
5 | constructor(attrs, scaleX, scaleY) {
|
---|
6 | super({
|
---|
7 | x: attrs.x,
|
---|
8 | y: attrs.y,
|
---|
9 | width: attrs.width * scaleX,
|
---|
10 | height: attrs.height * scaleY,
|
---|
11 | fill: "#A2D9FF",
|
---|
12 | stroke: "black",
|
---|
13 | strokeWidth: 1,
|
---|
14 | draggable: false,
|
---|
15 | rotation: attrs.rotation,
|
---|
16 | cornerRadius: 3
|
---|
17 | });
|
---|
18 |
|
---|
19 | console.info("FNUM RENDER:",attrs.floor_num)
|
---|
20 |
|
---|
21 | this.floorNum = attrs.floor_num
|
---|
22 |
|
---|
23 | this.info.name = attrs.obj_name;
|
---|
24 | this.info.type = attrs.room_type;
|
---|
25 | this.info.description = attrs.description;
|
---|
26 | this.class = "Room";
|
---|
27 | this.textOffsetX = -50;
|
---|
28 |
|
---|
29 | this.eventName = "openRoomInfoPanel"
|
---|
30 |
|
---|
31 | this.on("mouseenter", () => {
|
---|
32 | console.log(this.info.name, "NAME");
|
---|
33 | this.fill("#65c3f8");
|
---|
34 | });
|
---|
35 | this.on("mouseleave", () => {
|
---|
36 | this.fill("#A2D9FF");
|
---|
37 | });
|
---|
38 |
|
---|
39 |
|
---|
40 |
|
---|
41 | // searched(){
|
---|
42 | // this.fill("#b92d39")
|
---|
43 | // }
|
---|
44 | // unsearched(){
|
---|
45 | // this.fill("#A2D9FF");
|
---|
46 | // }
|
---|
47 |
|
---|
48 | // console.log("ATTRS: " + attrs);
|
---|
49 |
|
---|
50 | this.initText();
|
---|
51 | }
|
---|
52 | highlight(){
|
---|
53 | this.fill("rgba(29,238,78,0.49)");
|
---|
54 | this.strokeWidth(2)
|
---|
55 | }
|
---|
56 | unHighlight(){
|
---|
57 | this.fill("#A2D9FF");
|
---|
58 | this.strokeWidth(1);
|
---|
59 | }
|
---|
60 | }
|
---|
61 | RenderedRoom.prototype.className = "RenderedRoom";
|
---|
62 | _registerNode(RenderedRoom);
|
---|