mudlet-map-renderer 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/map-fragment/draw/renderer.js +29 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -89,6 +89,7 @@ class Renderer {
|
|
|
89
89
|
this.exitsRendered = {};
|
|
90
90
|
this.defualtColor = new paper.Color(this.colors.default[0] / 255, this.colors.default[1] / 255, this.colors.default[2] / 255);
|
|
91
91
|
this.highlights = [];
|
|
92
|
+
this.path = [];
|
|
92
93
|
this.render();
|
|
93
94
|
}
|
|
94
95
|
|
|
@@ -696,11 +697,38 @@ class Renderer {
|
|
|
696
697
|
this.highlights.push(highlight)
|
|
697
698
|
}
|
|
698
699
|
|
|
699
|
-
clearHighlight(
|
|
700
|
+
clearHighlight() {
|
|
700
701
|
this.highlights.forEach((element) => element.remove());
|
|
701
702
|
this.highlights = [];
|
|
702
703
|
}
|
|
703
704
|
|
|
705
|
+
renderPath(locations, color) {
|
|
706
|
+
this.overlayLayer.activate();
|
|
707
|
+
locations.forEach(id => {
|
|
708
|
+
let room = this.area.getRoomById(id);
|
|
709
|
+
let startPoint = new paper.Point(room.x + this.roomFactor * 0.5, room.y + this.roomFactor * 0.5)
|
|
710
|
+
let exits = Object.values(room.exits).concat(Object.values(room.specialExits))
|
|
711
|
+
exits.forEach(exitRoomId => {
|
|
712
|
+
if (locations.indexOf(exitRoomId) > -1) {
|
|
713
|
+
let exitRoom = this.area.getRoomById(exitRoomId);
|
|
714
|
+
let endPoint = new paper.Point(exitRoom.x + this.roomFactor * 0.5, exitRoom.y + this.roomFactor * 0.5)
|
|
715
|
+
let line = new paper.Path.Line(startPoint, endPoint)
|
|
716
|
+
line.strokeWidth = this.exitFactor * 4;
|
|
717
|
+
if (color === undefined) {
|
|
718
|
+
color = [0.4, 0.9, 0.3];
|
|
719
|
+
}
|
|
720
|
+
line.strokeColor = new paper.Color(color[0], color[1], color[2]);
|
|
721
|
+
this.path.push(line)
|
|
722
|
+
}
|
|
723
|
+
})
|
|
724
|
+
})
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
clearPath() {
|
|
728
|
+
this.path.forEach((element) => element.remove());
|
|
729
|
+
this.path = [];
|
|
730
|
+
}
|
|
731
|
+
|
|
704
732
|
|
|
705
733
|
clear() {
|
|
706
734
|
this.paper.clear();
|