mudlet-map-renderer 0.0.10 → 0.0.13
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 +9 -0
- package/README.md +2 -0
- package/map-fragment/draw/renderer.js +12 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -8,7 +8,9 @@ const gridSize = 20;
|
|
|
8
8
|
const Colors = {
|
|
9
9
|
OPEN_DOOR : new paper.Color(10 / 255, 155 / 255, 10 / 255),
|
|
10
10
|
CLOSED_DOOR : new paper.Color(226 / 255, 205 / 255, 59 / 255),
|
|
11
|
-
LOCKED_DOOR : new paper.Color(155 / 255, 10 / 255, 10 / 255)
|
|
11
|
+
LOCKED_DOOR : new paper.Color(155 / 255, 10 / 255, 10 / 255),
|
|
12
|
+
DEFAULT_BACKGROUND : new paper.Color(0, 0, 0),
|
|
13
|
+
DEFAULT : new paper.Color(1, 1, 1),
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
class Settings {
|
|
@@ -23,7 +25,8 @@ class Settings {
|
|
|
23
25
|
this.showLabels = true;
|
|
24
26
|
this.uniformLevelSize = false;
|
|
25
27
|
this.fontFamily = 'sans-serif';
|
|
26
|
-
this.mapBackground =
|
|
28
|
+
this.mapBackground = Colors.DEFAULT_BACKGROUND
|
|
29
|
+
this.linesColor = Colors.DEFAULT
|
|
27
30
|
this.transparentLabels = false;
|
|
28
31
|
}
|
|
29
32
|
}
|
|
@@ -157,11 +160,9 @@ class Renderer {
|
|
|
157
160
|
color = [114, 1, 0];
|
|
158
161
|
}
|
|
159
162
|
let roomColor = new paper.Color(color[0] / 255, color[1] / 255, color[2] / 255, 1);
|
|
160
|
-
|
|
161
|
-
roomShape.fillColor = roomColor;
|
|
162
|
-
}
|
|
163
|
+
roomShape.fillColor = !this.settings.frameMode ? roomColor : new paper.Color(this.settings.mapBackground);
|
|
163
164
|
roomShape.strokeWidth = this.exitFactor;
|
|
164
|
-
roomShape.strokeColor = !this.settings.borders || this.settings.frameMode ? roomColor : this.
|
|
165
|
+
roomShape.strokeColor = !this.settings.borders || this.settings.frameMode ? roomColor : this.settings.linesColor;
|
|
165
166
|
|
|
166
167
|
room.render = roomShape;
|
|
167
168
|
|
|
@@ -216,9 +217,9 @@ class Renderer {
|
|
|
216
217
|
path.moveTo(exitPoint);
|
|
217
218
|
path.lineTo(secondPoint);
|
|
218
219
|
path.strokeWidth = this.exitFactor;
|
|
219
|
-
path.strokeColor = this.
|
|
220
|
+
path.strokeColor = this.settings.linesColor;
|
|
220
221
|
} else {
|
|
221
|
-
this.renderArrow(exitPoint, secondPoint, this.
|
|
222
|
+
this.renderArrow(exitPoint, secondPoint, this.settings.linesColor, [], this.exitFactor, this.settings.linesColor, true);
|
|
222
223
|
}
|
|
223
224
|
} else {
|
|
224
225
|
secondPoint = new paper.Point(room.x + this.roomFactor / 2, room.y + this.roomFactor / 2);
|
|
@@ -266,7 +267,7 @@ class Renderer {
|
|
|
266
267
|
} else {
|
|
267
268
|
secondPoint = new paper.Point(room.x + this.roomFactor / 2, room.y + this.roomFactor / 2);
|
|
268
269
|
path = this.renderArrow(exitPoint, secondPoint, this.defualtColor, [], this.exitFactor);
|
|
269
|
-
path.strokeColor = this.
|
|
270
|
+
path.strokeColor = this.settings.linesColor;
|
|
270
271
|
path.scale(1, exitPoint);
|
|
271
272
|
path.rotate(180, exitPoint);
|
|
272
273
|
}
|
|
@@ -387,7 +388,7 @@ class Renderer {
|
|
|
387
388
|
path.scale(2);
|
|
388
389
|
path.position = exitPoint;
|
|
389
390
|
path.strokeWidth = this.exitFactor;
|
|
390
|
-
path.strokeColor = this.
|
|
391
|
+
path.strokeColor = this.settings.linesColor;
|
|
391
392
|
}
|
|
392
393
|
return path;
|
|
393
394
|
}
|
|
@@ -529,7 +530,7 @@ class Renderer {
|
|
|
529
530
|
}
|
|
530
531
|
let text = new paper.PointText(background.bounds.center.add(0, 0.15));
|
|
531
532
|
text.fillColor = new paper.Color(value.FgColor.r / 255, value.FgColor.g / 255, value.FgColor.b / 255);
|
|
532
|
-
text.fontSize = 0.75;
|
|
533
|
+
text.fontSize = Math.min(0.75, value.Width / (value.Text.length / 2));
|
|
533
534
|
text.content = value.Text;
|
|
534
535
|
text.fontFamily = this.settings.fontFamily;
|
|
535
536
|
text.justification = "center";
|