@scm-js/plugin-api 1.51.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.
Files changed (2) hide show
  1. package/index.d.ts +40 -1
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -41,7 +41,12 @@ export type CombineMode =
41
41
  /** Only the last occurrence is used — of those at least the section's minimum length. */
42
42
  | "last"
43
43
  /** Only the first occurrence is used — of those at least the section's minimum length. */
44
- | "first";
44
+ | "first"
45
+ /**
46
+ * A settings table: each occurrence changes only the entries it marks as not using the
47
+ * game's own values (`EntryLayout`), the rest keep what an earlier one gave them.
48
+ */
49
+ | "entries";
45
50
  /**
46
51
  * The byte encodings a map's text can be in, and how to tell which one a file used.
47
52
  *
@@ -5093,6 +5098,15 @@ export interface MapViewSpec {
5093
5098
  * where they were. Not called when another map, already showing the view, comes to the front.
5094
5099
  */
5095
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;
5096
5110
  /**
5097
5111
  * What the minimap shows while the view is shown. Without it the minimap shows the map, and
5098
5112
  * its box and presses are the map's own view's (hidden behind this one).
@@ -5141,6 +5155,20 @@ export interface MapViewMinimapSpec {
5141
5155
  */
5142
5156
  press?(x: number, y: number): void;
5143
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
+ }
5144
5172
  /** Map pixels to minimap canvas pixels, for `MapViewMinimapSpec.draw`. */
5145
5173
  export interface MinimapView {
5146
5174
  /** Minimap canvas pixels per map pixel. */
@@ -5173,6 +5201,17 @@ export interface MapViewHandle extends Disposable {
5173
5201
  * the same scale.
5174
5202
  */
5175
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;
5176
5215
  /** Make the minimap's picture again (`minimap.draw`), at most once a frame. Cheap: call it as the view's contents move. */
5177
5216
  redrawMinimap(): void;
5178
5217
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.51.0",
3
+ "version": "1.53.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",