mudlet-map-renderer 0.29.1-konva → 0.30.0-konva

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.
@@ -1,4 +1,4 @@
1
- import { DrawingBackend, GroupNode, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
1
+ import { DrawingBackend, GroupNode, CoordFn, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
2
2
  /**
3
3
  * Decorator that wraps a DrawingBackend and remaps all colors to a
4
4
  * technical blueprint aesthetic (white lines on deep blue).
@@ -27,4 +27,10 @@ export declare class BlueprintBackend implements DrawingBackend {
27
27
  addPolygon(parent: GroupNode, config: PolygonConfig): void;
28
28
  addText(parent: GroupNode, config: TextConfig): void;
29
29
  addImage(parent: GroupNode, config: ImageConfig): void;
30
+ getExitDepthOffset(): {
31
+ x: number;
32
+ y: number;
33
+ };
34
+ getTransform(): CoordFn;
35
+ getInverseTransform(): CoordFn;
30
36
  }
@@ -89,6 +89,12 @@ export interface ImageConfig {
89
89
  * When set, x/y/width/height describe the source rect; the matrix positions the output. */
90
90
  transform?: [number, number, number, number, number, number];
91
91
  }
92
+ /** Forward/inverse 2D coordinate transform, used by backends that warp map space (e.g. isometric). */
93
+ export type CoordFn = (x: number, y: number) => {
94
+ x: number;
95
+ y: number;
96
+ };
97
+ export declare const IDENTITY_TRANSFORM: CoordFn;
92
98
  export interface DrawingBackend {
93
99
  createGroup(x: number, y: number): GroupNode;
94
100
  addRect(parent: GroupNode, config: RectConfig): void;
@@ -97,4 +103,21 @@ export interface DrawingBackend {
97
103
  addPolygon(parent: GroupNode, config: PolygonConfig): void;
98
104
  addText(parent: GroupNode, config: TextConfig): void;
99
105
  addImage(parent: GroupNode, config: ImageConfig): void;
106
+ /**
107
+ * Cartesian offset for exit line groups so they connect at the cube base
108
+ * instead of the top face. Returns {x:0, y:0} for flat backends.
109
+ */
110
+ getExitDepthOffset(): {
111
+ x: number;
112
+ y: number;
113
+ };
114
+ /**
115
+ * Map-space → render-space transform. Identity for flat backends; non-identity
116
+ * for backends that warp coordinates (e.g. {@link IsometricBackend}).
117
+ * Decorators delegate to their inner backend.
118
+ * MapRenderer auto-applies this to culling and grid rendering when the backend is set.
119
+ */
120
+ getTransform(): CoordFn;
121
+ /** Inverse of {@link getTransform}. */
122
+ getInverseTransform(): CoordFn;
100
123
  }
@@ -1,4 +1,4 @@
1
- import { DrawingBackend, GroupNode, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
1
+ import { DrawingBackend, GroupNode, CoordFn, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
2
2
  /**
3
3
  * Rotation angle in degrees for the isometric view.
4
4
  * Any number is accepted. Common presets:
@@ -62,14 +62,9 @@ export declare class IsometricBackend implements DrawingBackend {
62
62
  private isoAffine;
63
63
  addText(parent: GroupNode, config: TextConfig): void;
64
64
  addImage(parent: GroupNode, config: ImageConfig): void;
65
- /**
66
- * Returns the iso transform function for use with CullingManager.setCoordinateTransform().
67
- */
68
- getTransform(): (x: number, y: number) => {
69
- x: number;
70
- y: number;
71
- };
72
- getInverseTransform(): (x: number, y: number) => {
65
+ getTransform(): CoordFn;
66
+ getInverseTransform(): CoordFn;
67
+ getExitDepthOffset(): {
73
68
  x: number;
74
69
  y: number;
75
70
  };
@@ -1,5 +1,5 @@
1
1
  import { default as Konva } from 'konva';
2
- import { DrawingBackend, GroupNode, LayerNode, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
2
+ import { DrawingBackend, GroupNode, LayerNode, CoordFn, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
3
3
  /**
4
4
  * Wraps a Konva.Group as a GroupNode.
5
5
  */
@@ -34,4 +34,10 @@ export declare class KonvaBackend implements DrawingBackend {
34
34
  addPolygon(parent: GroupNode, config: PolygonConfig): void;
35
35
  addText(parent: GroupNode, config: TextConfig): void;
36
36
  addImage(parent: GroupNode, config: ImageConfig): void;
37
+ getExitDepthOffset(): {
38
+ x: number;
39
+ y: number;
40
+ };
41
+ getTransform(): CoordFn;
42
+ getInverseTransform(): CoordFn;
37
43
  }
@@ -1,4 +1,4 @@
1
- import { DrawingBackend, GroupNode, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
1
+ import { DrawingBackend, GroupNode, CoordFn, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
2
2
  /**
3
3
  * Decorator that wraps a DrawingBackend and remaps all colors to a
4
4
  * cyberpunk/neon aesthetic — glowing colored outlines on a dark background.
@@ -25,4 +25,10 @@ export declare class NeonBackend implements DrawingBackend {
25
25
  addPolygon(parent: GroupNode, config: PolygonConfig): void;
26
26
  addText(parent: GroupNode, config: TextConfig): void;
27
27
  addImage(parent: GroupNode, config: ImageConfig): void;
28
+ getExitDepthOffset(): {
29
+ x: number;
30
+ y: number;
31
+ };
32
+ getTransform(): CoordFn;
33
+ getInverseTransform(): CoordFn;
28
34
  }
@@ -1,4 +1,4 @@
1
- import { DrawingBackend, GroupNode, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
1
+ import { DrawingBackend, GroupNode, CoordFn, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
2
2
  /**
3
3
  * Decorator that wraps a DrawingBackend and remaps all colors to a
4
4
  * warm sepia / old-parchment palette.
@@ -40,4 +40,10 @@ export declare class ParchmentBackend implements DrawingBackend {
40
40
  addPolygon(parent: GroupNode, config: PolygonConfig): void;
41
41
  addText(parent: GroupNode, config: TextConfig): void;
42
42
  addImage(parent: GroupNode, config: ImageConfig): void;
43
+ getExitDepthOffset(): {
44
+ x: number;
45
+ y: number;
46
+ };
47
+ getTransform(): CoordFn;
48
+ getInverseTransform(): CoordFn;
43
49
  }
@@ -1,4 +1,4 @@
1
- import { DrawingBackend, GroupNode, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
1
+ import { DrawingBackend, GroupNode, CoordFn, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
2
2
  /**
3
3
  * Decorator that wraps a DrawingBackend and applies hand-drawn "pencil" wobble
4
4
  * to all shapes. Text and images pass through unchanged.
@@ -33,4 +33,10 @@ export declare class SketchyBackend implements DrawingBackend {
33
33
  addPolygon(parent: GroupNode, config: PolygonConfig): void;
34
34
  addText(parent: GroupNode, config: TextConfig): void;
35
35
  addImage(parent: GroupNode, config: ImageConfig): void;
36
+ getExitDepthOffset(): {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ getTransform(): CoordFn;
41
+ getInverseTransform(): CoordFn;
36
42
  }
@@ -1,4 +1,4 @@
1
- import { DrawingBackend, GroupNode, LayerNode, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
1
+ import { DrawingBackend, GroupNode, LayerNode, CoordFn, RectConfig, CircleConfig, LineConfig, PolygonConfig, TextConfig, ImageConfig } from './DrawingBackend';
2
2
  /**
3
3
  * SVG implementation of GroupNode.
4
4
  * Accumulates SVG element strings at a given (x, y) offset.
@@ -43,4 +43,10 @@ export declare class SvgBackend implements DrawingBackend {
43
43
  addPolygon(parent: GroupNode, config: PolygonConfig): void;
44
44
  addText(parent: GroupNode, config: TextConfig): void;
45
45
  addImage(parent: GroupNode, config: ImageConfig): void;
46
+ getExitDepthOffset(): {
47
+ x: number;
48
+ y: number;
49
+ };
50
+ getTransform(): CoordFn;
51
+ getInverseTransform(): CoordFn;
46
52
  }