mudlet-map-renderer 2.2.0 → 2.3.1
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/README.md +28 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.mjs +1033 -457
- package/dist/index.mjs.map +1 -1
- package/dist/labelPlacement.d.ts +132 -0
- package/dist/overlay/RippleEffect.d.ts +48 -0
- package/dist/overlay/WaypointOverlay.d.ts +70 -0
- package/dist/style/index.d.ts +14 -0
- package/dist/style/shape/DarkModernStyle.d.ts +15 -0
- package/dist/style/shape/TreasureMapStyle.d.ts +23 -0
- package/dist/style/shape/index.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -186,6 +186,34 @@ For large maps, spatial culling hides off-screen rooms for better performance:
|
|
|
186
186
|
renderer.setCullingMode('indexed');
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
+
### OffscreenCanvas rendering (Web Worker)
|
|
190
|
+
|
|
191
|
+
For large maps, an opt-in backend moves per-frame rasterisation into a Web
|
|
192
|
+
Worker via `OffscreenCanvas`, keeping the main thread responsive during
|
|
193
|
+
pan/zoom. The default Konva backend is unchanged — pass the worker backend to
|
|
194
|
+
`MapRenderer`'s `backendFactory` parameter:
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import { MapRenderer, createSettings } from 'mudlet-map-renderer';
|
|
198
|
+
import { createOffscreenBackend } from 'mudlet-map-renderer/offscreen';
|
|
199
|
+
|
|
200
|
+
const renderer = new MapRenderer(
|
|
201
|
+
mapReader,
|
|
202
|
+
createSettings(),
|
|
203
|
+
container,
|
|
204
|
+
createOffscreenBackend(container), // ← opt in
|
|
205
|
+
);
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Everything else (drawing, navigation, styles, highlights, paths, hit-testing,
|
|
209
|
+
events) works as usual. Hit-testing and `getDrawnExits()` stay synchronous; the
|
|
210
|
+
one caveat is that `exportCanvas()` returns `undefined` (use the headless
|
|
211
|
+
exporters instead). Image labels, the ambient-light overlay, and live effects
|
|
212
|
+
are all supported.
|
|
213
|
+
|
|
214
|
+
See **[docs/offscreen-rendering.md](docs/offscreen-rendering.md)** for the full
|
|
215
|
+
guide — architecture, feature support, limitations, benchmarks, and the API.
|
|
216
|
+
|
|
189
217
|
### Styles
|
|
190
218
|
|
|
191
219
|
A `Style` is a target-agnostic visual transformer. One style drives the
|
package/dist/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type { CameraTransform } from './draw/DrawCommandBuilder';
|
|
|
25
25
|
export { svgFromBatches } from './render/SvgRenderer';
|
|
26
26
|
export { renderToCanvas } from './render/CanvasRenderer';
|
|
27
27
|
export type { ImageFactory, CanvasRenderOptions } from './render/CanvasRenderer';
|
|
28
|
-
export { Parchment, Blueprint, Neon, Sketchy, Isometric, Construction, SciFi, GradientRooms, StainedGlass, GraphPaper, Topographic, Watercolor, compose, identityStyle, applyStyleToShapes, } from './style';
|
|
28
|
+
export { Parchment, Blueprint, Neon, Sketchy, Isometric, Construction, SciFi, GradientRooms, StainedGlass, GraphPaper, Topographic, Watercolor, DarkModern, TreasureMap, treasureMapDecorations, compose, identityStyle, applyStyleToShapes, } from './style';
|
|
29
29
|
export type { Style, StyleContext, SketchyOptions, IsometricOptions, IsometricRotation, GradientRoomsOptions, WatercolorOptions, } from './style';
|
|
30
30
|
export type { Exporter, ExportContext, ExportCanvas } from './export/Exporter';
|
|
31
31
|
export { SvgExporter } from './export/SvgExporter';
|
|
@@ -38,6 +38,12 @@ export type { SceneOverlay, SceneOverlayContext } from './overlay/SceneOverlay';
|
|
|
38
38
|
export type { LiveEffect, CoordinateTransform } from './overlay/LiveEffect';
|
|
39
39
|
export { AmbientLightOverlay } from './overlay/AmbientLightOverlay';
|
|
40
40
|
export type { AmbientLightOptions } from './overlay/AmbientLightOverlay';
|
|
41
|
+
export { RippleEffect } from './overlay/RippleEffect';
|
|
42
|
+
export type { RippleOptions } from './overlay/RippleEffect';
|
|
43
|
+
export { WaypointOverlay } from './overlay/WaypointOverlay';
|
|
44
|
+
export type { Waypoint } from './overlay/WaypointOverlay';
|
|
45
|
+
export { placeLabels } from './labelPlacement';
|
|
46
|
+
export type { Direction8, Rect, Obstacle, LabelPlacementItem, PlacedLabel, PlaceLabelsOptions, SlotScore, } from './labelPlacement';
|
|
41
47
|
export { default as MapReader } from './reader/MapReader';
|
|
42
48
|
export type { IMapReader } from './reader/MapReader';
|
|
43
49
|
export { default as PathFinder } from './PathFinder';
|