@scm-js/plugin-api 1.52.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.
- package/index.d.ts +77 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -5098,11 +5098,38 @@ export interface MapViewSpec {
|
|
|
5098
5098
|
* where they were. Not called when another map, already showing the view, comes to the front.
|
|
5099
5099
|
*/
|
|
5100
5100
|
onShow?(look: MapViewCamera): void;
|
|
5101
|
+
/**
|
|
5102
|
+
* The person zoomed while the view is shown — View ▸ Zoom In, Zoom Out, one of the levels or
|
|
5103
|
+
* Zoom to Fit, the toolbar's buttons, their keys, or a wheel you passed on (`MapViewHandle.wheel`):
|
|
5104
|
+
* look at `look`, at that scale or as near to it as the view goes. The editor works the view's
|
|
5105
|
+
* zoom out from where it last said it looks (`setCamera`) and the view's size on the screen, and
|
|
5106
|
+
* shows it in the toolbar and the status bar: say where you look after each change, or the next
|
|
5107
|
+
* step starts from the old scale. Without `onZoom` the editor's zoom is the map's, hidden behind.
|
|
5108
|
+
*/
|
|
5109
|
+
onZoom?(look: MapViewCamera): void;
|
|
5101
5110
|
/**
|
|
5102
5111
|
* What the minimap shows while the view is shown. Without it the minimap shows the map, and
|
|
5103
5112
|
* its box and presses are the map's own view's (hidden behind this one).
|
|
5104
5113
|
*/
|
|
5105
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;
|
|
5106
5133
|
}
|
|
5107
5134
|
/**
|
|
5108
5135
|
* Where a view looks, in map pixels (32 to a tile): the point in the middle of what it shows,
|
|
@@ -5146,6 +5173,20 @@ export interface MapViewMinimapSpec {
|
|
|
5146
5173
|
*/
|
|
5147
5174
|
press?(x: number, y: number): void;
|
|
5148
5175
|
}
|
|
5176
|
+
/**
|
|
5177
|
+
* A wheel turned over a map view (`MapViewHandle.wheel`): as the browser's `WheelEvent` has it,
|
|
5178
|
+
* and the map pixel under the pointer.
|
|
5179
|
+
*/
|
|
5180
|
+
export interface MapViewWheel {
|
|
5181
|
+
deltaY: number;
|
|
5182
|
+
/** `WheelEvent.deltaMode`: 0 pixels (as when left out), 1 lines, 2 pages. */
|
|
5183
|
+
deltaMode?: number;
|
|
5184
|
+
ctrlKey?: boolean;
|
|
5185
|
+
metaKey?: boolean;
|
|
5186
|
+
shiftKey?: boolean;
|
|
5187
|
+
x: number;
|
|
5188
|
+
y: number;
|
|
5189
|
+
}
|
|
5149
5190
|
/** Map pixels to minimap canvas pixels, for `MapViewMinimapSpec.draw`. */
|
|
5150
5191
|
export interface MinimapView {
|
|
5151
5192
|
/** Minimap canvas pixels per map pixel. */
|
|
@@ -5178,8 +5219,44 @@ export interface MapViewHandle extends Disposable {
|
|
|
5178
5219
|
* the same scale.
|
|
5179
5220
|
*/
|
|
5180
5221
|
setCamera(camera: MapViewCamera): void;
|
|
5222
|
+
/**
|
|
5223
|
+
* A wheel turned over the view, for the editor to zoom by the same rule as over the map: with
|
|
5224
|
+
* Ctrl, or alone where the person's preferences say the wheel zooms, toward the pointer where
|
|
5225
|
+
* they say that. A step calls `onZoom`. Whether the editor took the wheel for zooming — false
|
|
5226
|
+
* too while the view is not shown or has no `onZoom`, and the wheel is yours to use.
|
|
5227
|
+
*
|
|
5228
|
+
* @example
|
|
5229
|
+
* // The play page in an iframe hands its wheel back; zoom the game by the editor's rule.
|
|
5230
|
+
* game.onWheel((w) => view.wheel(w));
|
|
5231
|
+
*/
|
|
5232
|
+
wheel(wheel: MapViewWheel): boolean;
|
|
5181
5233
|
/** Make the minimap's picture again (`minimap.draw`), at most once a frame. Cheap: call it as the view's contents move. */
|
|
5182
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;
|
|
5183
5260
|
}
|
|
5184
5261
|
export interface PanelHandle {
|
|
5185
5262
|
close(): void;
|