Changeset 0c6b92a for imaps-frontend/src/scripts/base/MapShape.js
- Timestamp:
- 12/12/24 17:06:06 (5 weeks ago)
- Branches:
- main
- Parents:
- d565449
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/src/scripts/base/MapShape.js
rd565449 r0c6b92a 6 6 throw new Error("Cannot instantiate abstract class BaseShape directly."); 7 7 } 8 9 console.log(config.x,"FFF"); 8 10 super(config); 9 11 this.layer = layer; … … 12 14 this.snappable = snap; 13 15 this._info = {}; 14 this. modalEventName = "";16 this.eventName = ""; 15 17 this.infoText = null; 18 this.floorNum; 16 19 17 20 this.shadowForStrokeEnabled(false); 18 21 this.on("mouseover", () => (document.body.style.cursor = "pointer")); 19 22 this.on("mouseout", () => (document.body.style.cursor = "default")); 20 // this.on("dblclick", (e) => { 21 // this.moveToTop(); 22 // this.getLayer() 23 // .find("Transformer") 24 // .forEach((t) => t.moveToTop()); 25 // }); 23 this.on("click", (e) => { 24 if(e.evt.altKey){ 25 this.moveToTop(); 26 this.getLayer() 27 .find("Transformer") 28 .forEach((t) => t.moveToTop()); 29 } 30 31 }); 26 32 27 33 if (snap) { 28 34 this.on("dragend", this.snapToGrid.bind(this)); 29 this.on('dblclick', this.snapToGrid.bind(this)) 35 this.on('dblclick', this.snapToGrid.bind(this)); 30 36 } 31 37 … … 36 42 }); 37 43 38 this.on('dragend', () => { 44 45 this.on('dragmove', () => { 39 46 if (this.infoText) { 40 47 this.updateTextPosition(); … … 76 83 } 77 84 85 86 destroy() { 87 super.destroy(); 88 if (this.infoText !== null) { 89 this.infoText.remove() 90 console.log("cleared text") 91 } 92 } 93 94 setInfo(infoObj){ 95 this.info = infoObj; 96 } 97 98 load(){ 99 console.log("Abstract function") 100 } 101 78 102 _sceneFunc(context) { 79 103 let width = this.width(); … … 93 117 } 94 118 119 updateText(shapeName){ 120 this.infoText.text = shapeName; 121 console.log("Updated text to : " + shapeName) 122 } 123 95 124 snapToGrid() { 96 125 this.position({ … … 98 127 y: Math.round(this.y() / this.blockSize) * this.blockSize, 99 128 }); 129 100 130 } 101 131
Note:
See TracChangeset
for help on using the changeset viewer.