@scm-js/plugin-api 1.52.0 → 1.53.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 +34 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -5098,6 +5098,15 @@ 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).
|
|
@@ -5146,6 +5155,20 @@ export interface MapViewMinimapSpec {
|
|
|
5146
5155
|
*/
|
|
5147
5156
|
press?(x: number, y: number): void;
|
|
5148
5157
|
}
|
|
5158
|
+
/**
|
|
5159
|
+
* A wheel turned over a map view (`MapViewHandle.wheel`): as the browser's `WheelEvent` has it,
|
|
5160
|
+
* and the map pixel under the pointer.
|
|
5161
|
+
*/
|
|
5162
|
+
export interface MapViewWheel {
|
|
5163
|
+
deltaY: number;
|
|
5164
|
+
/** `WheelEvent.deltaMode`: 0 pixels (as when left out), 1 lines, 2 pages. */
|
|
5165
|
+
deltaMode?: number;
|
|
5166
|
+
ctrlKey?: boolean;
|
|
5167
|
+
metaKey?: boolean;
|
|
5168
|
+
shiftKey?: boolean;
|
|
5169
|
+
x: number;
|
|
5170
|
+
y: number;
|
|
5171
|
+
}
|
|
5149
5172
|
/** Map pixels to minimap canvas pixels, for `MapViewMinimapSpec.draw`. */
|
|
5150
5173
|
export interface MinimapView {
|
|
5151
5174
|
/** Minimap canvas pixels per map pixel. */
|
|
@@ -5178,6 +5201,17 @@ export interface MapViewHandle extends Disposable {
|
|
|
5178
5201
|
* the same scale.
|
|
5179
5202
|
*/
|
|
5180
5203
|
setCamera(camera: MapViewCamera): void;
|
|
5204
|
+
/**
|
|
5205
|
+
* A wheel turned over the view, for the editor to zoom by the same rule as over the map: with
|
|
5206
|
+
* Ctrl, or alone where the person's preferences say the wheel zooms, toward the pointer where
|
|
5207
|
+
* they say that. A step calls `onZoom`. Whether the editor took the wheel for zooming — false
|
|
5208
|
+
* too while the view is not shown or has no `onZoom`, and the wheel is yours to use.
|
|
5209
|
+
*
|
|
5210
|
+
* @example
|
|
5211
|
+
* // The play page in an iframe hands its wheel back; zoom the game by the editor's rule.
|
|
5212
|
+
* game.onWheel((w) => view.wheel(w));
|
|
5213
|
+
*/
|
|
5214
|
+
wheel(wheel: MapViewWheel): boolean;
|
|
5181
5215
|
/** Make the minimap's picture again (`minimap.draw`), at most once a frame. Cheap: call it as the view's contents move. */
|
|
5182
5216
|
redrawMinimap(): void;
|
|
5183
5217
|
}
|