@scm-js/plugin-api 1.53.0 → 1.54.0

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.
Files changed (2) hide show
  1. package/index.d.ts +43 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -5112,6 +5112,24 @@ export interface MapViewSpec {
5112
5112
  * its box and presses are the map's own view's (hidden behind this one).
5113
5113
  */
5114
5114
  minimap?: MapViewMinimapSpec;
5115
+ /**
5116
+ * View ▸ Fog of War, the toolbar's button and its key, while the view is shown: turn the view's
5117
+ * own fog on or off. The toggle then shows the view's fog, as you last said it
5118
+ * (`MapViewHandle.setFog`), not the map's. Without `onFog` the toggle is off while the view is shown.
5119
+ */
5120
+ onFog?(on: boolean): void;
5121
+ /**
5122
+ * What `MapViewHandle.paintOver` draws changed — View ▸ Grid or Locations turned on or off, the
5123
+ * grid's settings, the map's locations, another plugin's overlay: draw over the view again. With
5124
+ * it the editor's Grid, Locations and Location Names toggles, and the other plugins' overlays,
5125
+ * stay on offer while the view is shown; without it they are off, as the view cannot show them.
5126
+ */
5127
+ onRepaint?(): void;
5128
+ }
5129
+ /** Where the pointer is over a map view (`MapViewHandle.setPointer`), in map pixels. */
5130
+ export interface MapViewPointer {
5131
+ x: number;
5132
+ y: number;
5115
5133
  }
5116
5134
  /**
5117
5135
  * Where a view looks, in map pixels (32 to a tile): the point in the middle of what it shows,
@@ -5214,6 +5232,31 @@ export interface MapViewHandle extends Disposable {
5214
5232
  wheel(wheel: MapViewWheel): boolean;
5215
5233
  /** Make the minimap's picture again (`minimap.draw`), at most once a frame. Cheap: call it as the view's contents move. */
5216
5234
  redrawMinimap(): void;
5235
+ /**
5236
+ * Whether the view shows its fog now, for View ▸ Fog of War and the toolbar's button while it
5237
+ * is shown (`onFog`); null when it has none to show at the moment, which greys the toggle. Say
5238
+ * it whenever it changes, by the person's hand or yours.
5239
+ */
5240
+ setFog(on: boolean | null): void;
5241
+ /**
5242
+ * Where the pointer is over the view, in map pixels, for the status bar's tile and position;
5243
+ * null once it leaves. A view in an iframe hears the pointer and the editor does not.
5244
+ */
5245
+ setPointer(at: MapViewPointer | null): void;
5246
+ /**
5247
+ * Draw what the editor draws over a map onto your canvas over the view, mapped by `view` as a
5248
+ * map tool's or an overlay's `draw` is: the grid and the locations as View ▸ Grid, Locations and
5249
+ * Location Names have them, then the other plugins' visible overlays (yours are your own to draw).
5250
+ * Call it from your own drawing, above the view's picture and below your marks, each time you
5251
+ * draw; `onRepaint` says when it would draw something else. Nothing while the view is not shown.
5252
+ *
5253
+ * @example
5254
+ * function drawOver(ctx: CanvasRenderingContext2D, v: MapView) {
5255
+ * handle.paintOver(ctx, v);
5256
+ * drawMyMarks(ctx, v);
5257
+ * }
5258
+ */
5259
+ paintOver(ctx: CanvasRenderingContext2D, view: MapView): void;
5217
5260
  }
5218
5261
  export interface PanelHandle {
5219
5262
  close(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.53.0",
3
+ "version": "1.54.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",