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 CHANGED
@@ -1,3 +1,12 @@
1
+ # 0.0.13
2
+ - add line color (experimental)
3
+
4
+ # 0.0.12
5
+ - try to limit label font size to fit within label bounds
6
+
7
+ # 0.0.11
8
+ - another fix frame mode for background selection
9
+
1
10
  # 0.0.10
2
11
  - fix frame mode for background selection
3
12
 
package/README.md CHANGED
@@ -52,5 +52,7 @@ class Settings {
52
52
  uniformLevelSize = false;
53
53
  fontFamily = 'sans-serif';
54
54
  mapBackground = "#000000";
55
+ linesColor = '#FFFFFF';
56
+ transparentLabels = false;
55
57
  }
56
58
  ```
@@ -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 = "#000000";
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
- if (!this.settings.frameMode) {
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.defualtColor;
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.defualtColor;
220
+ path.strokeColor = this.settings.linesColor;
220
221
  } else {
221
- this.renderArrow(exitPoint, secondPoint, this.defualtColor, [], this.exitFactor, this.defualtColor, true);
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.defualtColor;
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.defualtColor;
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mudlet-map-renderer",
3
- "version": "0.0.10",
3
+ "version": "0.0.13",
4
4
  "keywords": [
5
5
  "mudlet",
6
6
  "map",