Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/src/scripts/rendered_shapes/RenderedRoom.js
rd565449 r0c6b92a 1 import RenderedMapShape from "./RenderedMapShape.js"; 1 import RenderedMapShape from "../base/RenderedMapShape.js"; 2 import {_registerNode} from "konva/lib/Global"; 2 3 3 export default class RenderedRoom extends RenderedMapShape{ 4 constructor(attrs,scaleX,scaleY){ 5 super({ 6 x: attrs.x, 7 y: attrs.y, 8 width: attrs.width * scaleX, 9 height: attrs.height * scaleY, 10 fill: 'white', 11 stroke: 'black', 12 strokeWidth: 1, 13 draggable: false, 14 rotation: attrs.rotation, 15 cornerRadius:3, 16 zIndex: 0 17 }); 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 18 19 this.info.name = attrs.obj_name; 20 this.info.description = attrs.description; 19 console.info("FNUM RENDER:",attrs.floor_num) 21 20 22 this.textOffsetX = -50 23 24 25 this.on("mouseenter",() => { 26 console.log("HOVER ROOM IN", this.x()); 27 console.log(this.info.name,"NAME"); 28 this.opacity(0.7); 29 this.fill("pink"); 30 }) 31 this.on("mouseleave", () => { 32 console.log("HOVER ROOM OUT"); 33 this.opacity(1); 34 this.fill("white"); 35 }) 21 this.floorNum = attrs.floor_num 36 22 37 this.initText() 38 } 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; 39 28 40 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 } 41 60 } 61 RenderedRoom.prototype.className = "RenderedRoom"; 62 _registerNode(RenderedRoom);
Note:
See TracChangeset
for help on using the changeset viewer.