mudlet-map-renderer 0.0.13 → 0.0.14

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,5 @@
1
+ # 0.0.14
2
+ - add area change clicks on custom exit lines
1
3
  # 0.0.13
2
4
  - add line color (experimental)
3
5
 
@@ -184,7 +184,7 @@ class Renderer {
184
184
  }
185
185
 
186
186
  for (let dir in room.customLines) {
187
- this.renderCustomLine(room, dir);
187
+ this.renderCustomLine(room, dir, room.exits[dir] ?? room.specialExits[dir]);
188
188
  }
189
189
 
190
190
  for (let dir in room.stubs) {
@@ -270,6 +270,7 @@ class Renderer {
270
270
  path.strokeColor = this.settings.linesColor;
271
271
  path.scale(1, exitPoint);
272
272
  path.rotate(180, exitPoint);
273
+ path.registerClick(() => this.emitter.dispatchEvent(new CustomEvent("areaArrowClick", { detail: targetId })));
273
274
  }
274
275
 
275
276
  room.exitsRenders.push(path);
@@ -281,7 +282,7 @@ class Renderer {
281
282
  return path;
282
283
  }
283
284
 
284
- renderCustomLine(room, dir) {
285
+ renderCustomLine(room, dir, targetId) {
285
286
  if (room.customLines[dir].points !== undefined && room.customLines[dir].points.length === 0) {
286
287
  return;
287
288
  }
@@ -340,6 +341,11 @@ class Renderer {
340
341
  path.strokeWidth = this.exitFactor;
341
342
  path.orgStrokeColor = path.strokeColor;
342
343
 
344
+ let targetRoom = this.area.getRoomById(targetId);
345
+ if (!targetRoom) {
346
+ path.registerClick(() => this.emitter.dispatchEvent(new CustomEvent("areaArrowClick", { detail: targetId })));
347
+ }
348
+
343
349
  room.exitsRenders.push(customLine);
344
350
 
345
351
  return customLine;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mudlet-map-renderer",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "keywords": [
5
5
  "mudlet",
6
6
  "map",