Changeset 79a0317 for imaps-frontend/src/scripts/shapes
- Timestamp:
- 01/21/25 03:08:24 (3 days ago)
- Branches:
- main
- Parents:
- 0c6b92a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/src/scripts/shapes/Entrance.js
r0c6b92a r79a0317 2 2 import MapNode from "../base/MapNode.js"; 3 3 import {node} from "prop-types"; 4 import ShapeRegistry from "../util/ShapeRegistry.js"; 5 import ShapeQuery from "../util/ShapeQuery.js"; 6 import Konva from "konva"; 4 7 5 8 export default class Entrance extends MapNode { … … 14 17 x: attrs.position.x, 15 18 y: attrs.position.y, 16 width: attrs.width ,17 height: attrs.height ,19 width: attrs.width * attrs.scaleX, 20 height: attrs.height * attrs.scaleY, 18 21 fill: "rgb(126,238,167)", 19 22 stroke: "#252627", … … 46 49 this.initText(); 47 50 this.moveToTop(); 51 52 console.log("room CONNECT: " + attrs.connected_room,this.info.connectedRoom + "CON") 53 console.log("entrance: " + this.info.name) 48 54 } 49 55 50 56 loadInfo(attrs) { 51 this.info.name = attrs.obj_name; 52 this.info.connectedRoom = attrs.connected_room; 53 this.info.description = attrs.description; 54 this.info.isMainEntrance = attrs.is_main_entrance; 55 this.info.selectedPins = attrs.connected_pins; 56 this.floorNum = attrs.floor_num; 57 this.info.name = attrs.obj_name ?? `Entrance${this.id} [${this.floorNum}F]`; 58 this.info.connectedRoom = attrs.connected_room ?? ``; 59 this.info.description = attrs.description ?? ``; 60 this.info.isMainEntrance = attrs.is_main_entrance ?? false; 61 this.info.selectedPins = attrs.connected_pins ?? []; 57 62 } 63 58 64 59 65 saveShapeDetails() { 60 66 console.info("fnum entrance",this.attrs.floorNum) 61 62 67 this.setAttr("connected_pins", this.info.selectedPins); 63 68 this.setAttr("obj_name", this.info.name); … … 75 80 76 81 setInfo(infoObj) { 77 console.log("SA VIKNA SETINFO")78 82 this.info = infoObj; 83 this.setHighlight(); 84 } 85 86 setHighlight(){ 87 console.log("info room: " + this.info.connectedRoom) 79 88 if(this.info.connectedRoom == null || this.info.connectedRoom === "" ){ 89 console.log("vleze if") 80 90 this.strokeWidth(2); 81 this.stroke("# a10114")91 this.stroke("#8a000d") 82 92 }else{ 83 93 this.strokeWidth(1) … … 85 95 } 86 96 } 97 98 onPlace() { 99 ShapeQuery 100 .findAllByTypeAndFloor(this.floorNum,"Room") 101 .forEach(room => { 102 if(Konva.Util.haveIntersection(room.getClientRect(),this.getClientRect())){ 103 this.info.connectedRoom = room.info.name; 104 } 105 }) 106 this.setHighlight() 107 } 87 108 } 88 109
Note:
See TracChangeset
for help on using the changeset viewer.