@thegraid/hexlib 1.1.5 → 1.1.8

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.
@@ -1,53 +1,63 @@
1
- export const playerColors = ['b', 'w']; // Player Colors!
2
- export const playerColorsC = ['b', 'w', 'c']; // Player Colors + Criminal!
1
+ const playerColorsLib = ['b', 'w']; // Player Colors!
2
+ export const playerColors = playerColorsLib.concat();
3
+ // Locally (for example, hextowns):
3
4
  export const playerColor0 = playerColors[0];
4
5
  export const playerColor1 = playerColors[1];
5
- export const playerColor2 = playerColorsC[2];
6
+ // export const playerColor2 = playerColorsC[2]
6
7
  export function otherColor(color) { return color === playerColor0 ? playerColor1 : playerColor0; }
7
- export function playerColorRecord(b, w, c) { return { b, w, c }; }
8
- ;
9
- export function playerColorRecordF(f) { return playerColorRecord(f(playerColor0), f(playerColor1), f(playerColor2)); }
8
+ /** @return \{ pc0: arg0 as T, pc1: arg1 as T, ...}: PlayerColorRecord\<T> */
9
+ export function playerColorRecord(...args) {
10
+ const rv = {};
11
+ playerColors.forEach((key, ndx) => rv[key] = (args[ndx]));
12
+ return rv;
13
+ }
14
+ export function playerColorRecordF(f) {
15
+ return playerColorRecord(...playerColors.map(pc => f(pc)));
16
+ }
10
17
  export class TP {
18
+ /** compose a URL of form wss://host.domain:port/path.
19
+ *
20
+ * @param scheme ['wss']
21
+ * @param host [TP.ghost]
22
+ * @param domain [TP.gdomain]
23
+ * @param port [TP.gport]
24
+ * @param path [''] supply your own '/' and any query part
25
+ */
11
26
  static buildURL(scheme = 'wss', host = TP.ghost, domain = TP.gdomain, port = TP.gport, path = '') {
12
27
  return `${scheme}://${host}.${domain}:${port}${path}`;
13
28
  }
29
+ /** return OwnPropertyNames that are NOT also in Object (ie: length, name, prototype) */
14
30
  static staticFields(over = TP) {
15
31
  const basic_props = Object.getOwnPropertyNames(class {
16
32
  }); // [length, prototype, name]
17
33
  const static_props = Object.getOwnPropertyNames(over).filter(k => !basic_props.includes(k));
18
34
  return static_props;
19
35
  }
20
- /** called by framework before TP is used; put your overrides here.
21
- * @param qParams
22
- * @param force true to apply exact value, if new key or new type.
23
- */
24
- static setParams(qParams = {}, force = false, over = TP) {
25
- /** do not muck with standard basic properties of all/empty classes */
26
- const static_props = TP.staticFields(over);
27
- for (let [key, value] of Object.entries(qParams)) {
28
- if (force || static_props.includes(key)) {
29
- if (!force && (typeof value === 'string' && typeof over[key] === 'number')) {
30
- value = Number.parseInt(value); // minimal effort to align types.
31
- }
32
- TP[key] = value; // set a static value in base; DANGER! not typesafe!
33
- }
34
- }
35
- }
36
36
  /**
37
- * After pushing all values from local subclass of TP into base TP,
38
- * delete them, so there is only the one copy in original base class: TP (from hexlib)
39
- * Local references should still get/set values in the base object.
37
+ * If local field is present in tplib, set local value in tplib, and delete it from local.
38
+ *
39
+ * So hexlib methods will see and use the value as TP.field
40
40
  *
41
- * This way, tsc still sees local TP for type safety,
42
- * but there is a single object for updates using Chooser.
41
+ * If tplib value is a number and local value is a string, try coerce using parseInt()
43
42
  *
44
- * @param local the locally created subclass of TP with static fields
43
+ * @param local source of the new values (typically TP-local or {...})
44
+ * @param force [false] if true, do not attempt to coerce value with parseInt().
45
+ * @param tplib [TP-lib] the target in which to set the values from local.
46
+ * @return local with tplib values removed
45
47
  */
46
- static eraseLocal(local) {
47
- const static_props = TP.staticFields(local);
48
- static_props.forEach(key => delete local[key]);
49
- const new_props = TP.staticFields(local);
50
- // assert new_props is empty!
48
+ static setParams(local = {}, force = false, tplib = TP) {
49
+ /** do not muck with standard basic properties of all/empty classes */
50
+ const static_props = TP.staticFields(tplib);
51
+ for (let [key, value] of Object.entries(local)) {
52
+ if (!static_props.includes(key))
53
+ continue; // if no collision leave in TP-local
54
+ if (!force && (typeof value === 'string' && typeof tplib[key] === 'number')) {
55
+ value = Number.parseInt(value); // minimal effort to align types.
56
+ }
57
+ tplib[key] = value; // set a static value in base; DANGER! not typesafe!
58
+ delete local[key]; // so future local[key] = value will tplib[key] = value;
59
+ }
60
+ return local;
51
61
  }
52
62
  /** the current map from PlayerColor to colorn */
53
63
  static colorScheme = playerColorRecordF(n => n);
@@ -1 +1 @@
1
- {"version":3,"file":"table-params.js","sourceRoot":"","sources":["../src/table-params.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,CAAU,CAAA,CAAC,iBAAiB;AACjE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAA,CAAC,4BAA4B;AAClF,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;AAG5C,MAAM,UAAU,UAAU,CAAC,KAAkB,IAAiB,OAAO,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAA,CAAC,CAAC;AAI3H,MAAM,UAAU,iBAAiB,CAAI,CAAI,EAAE,CAAI,EAAE,CAAI,IAA0B,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA,CAAC,CAAC;AAAA,CAAC;AACpG,MAAM,UAAU,kBAAkB,CAAI,CAAyB,IAAI,OAAO,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,CAAA,CAAC,CAAC;AAKhJ,MAAM,OAAO,EAAE;IACb,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,EAAE,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE;QAC9F,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EvC,gCAAgC;IAChC,MAAM,CAAC,SAAS,GAAY,GAAG,CAAA;IAC/B,MAAM,CAAC,UAAU,GAAW,GAAG,CAAA;IAC/B,MAAM,CAAC,SAAS,GAAY,GAAG,CAAA,CAAC,iDAAiD;IAEjF,MAAM,CAAC,OAAO,GAAW,yBAAyB,CAAC;IACnD,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAA;IAExD,MAAM,CAAC,KAAK,GAAW,OAAO,CAAA,CAAG,uBAAuB;IACxD,MAAM,CAAC,OAAO,GAAW,cAAc,CAAA;IACvC,MAAM,CAAC,KAAK,GAAW,IAAI,CAAA;IAC3B,MAAM,CAAC,UAAU,GAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAE,+BAA+B;IAC3E,MAAM,CAAC,YAAY,GAAW,aAAa,CAAC;IAE5C,MAAM,CAAC,OAAO,GAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,YAAY,GAAW,GAAG,CAAA,CAAC,wBAAwB;IAE1D,MAAM,CAAC,iBAAiB,GAAY,IAAI,CAAC,CAAC,0CAA0C;IAEpF,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;IAErB,kBAAkB;IAClB,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;IACnB,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC"}
package/dist/table.d.ts CHANGED
@@ -6,20 +6,13 @@ import { Container, DisplayObject, EventDispatcher, Shape, Stage, Text } from "@
6
6
  import { NamedContainer, NamedObject, type GamePlay } from "./game-play";
7
7
  import { Scenario } from "./game-setup";
8
8
  import type { GameState } from "./game-state";
9
- import { Hex, IHex2, IdHex, RecycleHex, HexM } from "./hex";
9
+ import { Hex, HexM, IdHex, IHex2, RecycleHex } from "./hex";
10
10
  import { XYWH } from "./hex-intfs";
11
11
  import { Player } from "./player";
12
12
  import { PlayerPanel } from "./player-panel";
13
13
  import { HexShape, RectShape, UtilButton } from "./shapes";
14
- import { PlayerColor } from "./table-params";
15
14
  import { Tile } from "./tile";
16
15
  import { TileSource } from "./tile-source";
17
- export type EventName = 'Claim' | 'Split' | 'Conflict' | 'merge' | 'redzone';
18
- export interface ActionButton extends Container {
19
- isEvent: boolean;
20
- pid: number;
21
- rollover?: ((b: ActionButton, over: boolean) => void);
22
- }
23
16
  export interface Dragable {
24
17
  dragFunc0(hex: IHex2, ctx: DragContext): void;
25
18
  dropFunc0(hex: IHex2, ctx: DragContext): void;
@@ -59,7 +52,7 @@ export declare class Table {
59
52
  static table: Table;
60
53
  static stageTable(obj: DisplayObject): Table;
61
54
  disp: EventDispatcher;
62
- namedOn(Aname: string, type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): void;
55
+ namedOn(Aname: string, type: string, listener: (eventObj: any) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): void;
63
56
  gamePlay: GamePlay;
64
57
  stage: Stage;
65
58
  bgRect: Shape;
@@ -97,6 +90,15 @@ export declare class Table {
97
90
  isVisible: boolean;
98
91
  /** method invokes closure defined in enableHexInspector. */
99
92
  toggleText(vis?: boolean): undefined;
93
+ cacheScale: number;
94
+ /**
95
+ * re-cache all Tiles with alternate cacheScale; improves resolution at high zoom.
96
+ *
97
+ * Alternate invocations return cacheScale to 0 (un-cached)
98
+ * @param setScale [TP.cacheTiles === 0] set true to force setting, false to toggle
99
+ * @param cacheScale [max(1, scaleCont.scaleX)] set to use specific scale
100
+ */
101
+ reCacheTiles(setScale?: boolean, cacheScale?: number): void;
100
102
  aiControl(color?: string, dx?: number, rad?: number): Container;
101
103
  /** all the non-map hexes created by newHex2 */
102
104
  newHexes: IHex2[];
@@ -407,7 +409,7 @@ export declare class Table {
407
409
  };
408
410
  /**
409
411
  * all number in units of dxdc or dydr
410
- * @param x0 frame left; relative to scaleCont
412
+ * @param x0 frame left; relative to scaleCont (offset from bgRect to hexCont)
411
413
  * @param y0 frame top; relative to scaleCont
412
414
  * @param w0 pad width; width of bgRect, beyond hexCont, centered on hexCont
413
415
  * @param h0 pad height; height of bgRect, beyond hexCont, centered on hexCont
@@ -431,16 +433,29 @@ export declare class Table {
431
433
  row: number;
432
434
  col: number;
433
435
  };
436
+ /**
437
+ * After setBackground() & hexCont.cache(); before makePerPlayer();
438
+ *
439
+ * Whatever: make overlays, score panel, extra tracks (auction...)
440
+ */
434
441
  layoutTable2(): void;
442
+ /**
443
+ * Make ParamGUI with a background RectShape, and make it dragable.
444
+ * @param makeGUI a function(Container) to create a ParamGUI
445
+ * @param name of the Container to hold the ParamGUI
446
+ * @param cx location of Container on scaleCont: cx * scale
447
+ * @param cy location of Container on scaleCont: cy * scale
448
+ * @param scale [TP.hexRad / 60] Container scaleX, scaleY
449
+ * @param d border size of background RectShape around/behind GUI Container
450
+ * @returns the gui returned from makeGUI(Table, Ccntainer)
451
+ */
435
452
  gpanel(makeGUI: (cont: Container) => ParamGUI, name: string, cx: number, cy: number, scale?: number, d?: number): ParamGUI;
436
453
  /**
437
- * makeNetworkGUI(parent)
438
- * makeParamGUI(parent)
439
- * makeParamGUI2(parent)
440
- * makeDragable()
441
- * @param table
454
+ * makeNetworkGUI(parent) -> gui3.ymax
455
+ * makeParamGUI(parent) -> gui1.ymax
456
+ * makeParamGUI2(parent) -> gui2.ymax
442
457
  */
443
- makeGUIs(): void;
458
+ makeGUIs(scale?: number, cx?: number, cy?: number, dy?: number): void;
444
459
  get panelHeight(): number;
445
460
  get panelOffset(): number;
446
461
  /**
@@ -1297,13 +1312,19 @@ export declare class Table {
1297
1312
  get tablePlanner(): TablePlanner;
1298
1313
  /**
1299
1314
  * All manual moves feed through this (drop & redo)
1315
+ *
1300
1316
  * TablePlanner.logMove(); then dispatchEvent() --> gamePlay.doPlayerMove()
1301
1317
  *
1302
1318
  * New: let Ship (Drag & Drop) do this.
1303
1319
  */
1304
1320
  doTableMove(ihex: IdHex): void;
1305
- /** All moves (GUI & player) feed through this: */
1306
- moveStoneToHex(ihex: IdHex, sc: PlayerColor): void;
1321
+ /** All moves (GUI & plannerMove) feed through here:
1322
+ *
1323
+ * gamePlay listens with playerMoveEvent(TileEvent)
1324
+ *
1325
+ * and eventually get to Player.doPlayerMove()
1326
+ */
1327
+ moveTileToHex(tile: Tile, ihex: IdHex): void;
1307
1328
  /** default scaling-up value */
1308
1329
  upscale: number;
1309
1330
  /** change cont.scale to given scale value. */
@@ -1315,27 +1336,25 @@ export declare class Table {
1315
1336
  steps: number;
1316
1337
  zscale: number;
1317
1338
  };
1318
- readonly scaleCont: ScaleableContainer2;
1339
+ readonly scaleCont: ScaleableContainer;
1319
1340
  /** makeScaleableBack and setup scaleParams
1320
- * @param bindkeys true if there's a GUI/user/keyboard
1341
+ * @param bindkeys true if there's a GUI/user/keyboard (Canvas)
1321
1342
  */
1322
- makeScaleCont(bindKeys: boolean): ScaleableContainer2;
1343
+ makeScaleCont(bindKeys: boolean): ScaleableContainer;
1323
1344
  bindKeys(): void;
1324
1345
  /** put a Rectangle Shape at (0,0) with XYWH bounds as given */
1325
1346
  setBackground(parent: Container, bounds: XYWH, bgColor?: string): RectShape & NamedObject;
1326
1347
  zoom(z?: number): void;
1327
1348
  pan(xy: XY): void;
1328
1349
  /**
1329
- * invoked before this.scaleC has been set
1330
- * @param scaleC same Container as this.scaleC
1331
- * @param char keybinding to set initial scale
1332
- * @param xos x-offset of scaleC in screen coords (pre-scale)
1333
- * @param yos y-offset of scaleC in screen coords (pre-scale)
1334
- * @param scale0 imitial scale [.5]
1350
+ * invoked before this.scaleCont has been set.
1351
+ * @param scaleC the ScaleableContainer to be used
1352
+ * @param isc ['a'] initial scale char, keybinding to reset to initial scale
1353
+ * @param xos initial x-offset of scaleC in screen coords (pre-scale)
1354
+ * @param yos initial y-offset of scaleC in screen coords (pre-scale)
1355
+ * @param scale0 [.5] initial scale
1335
1356
  */
1336
- bindKeysToScale(scaleC: ScaleableContainer2, char: string, xos: number, yos: number, scale0?: number): void;
1337
- }
1338
- declare class ScaleableContainer2 extends ScaleableContainer {
1357
+ bindKeysToScale(scaleC: ScaleableContainer, isc?: string, xos?: number, yos?: number, scale0?: number): void;
1339
1358
  }
1340
1359
  export {};
1341
1360
  //# sourceMappingURL=table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../src/table.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAqB,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAgB,QAAQ,EAAgB,kBAAkB,EAAS,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC9K,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAwB,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAC/H,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAU,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAe,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,WAAW,EAAkC,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EA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MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,SAAa;IAQnE,IAAI,CAAC,CAAC,SAAM;IAUZ,GAAG,CAAC,EAAE,EAAE,EAAE;IAMV;;;;;;;OAOG;IAEH,eAAe,CAAC,MAAM,EAAE,kBAAkB,EAAE,GAAG,SAAM,EAAE,GAAG,SAAM,EAAE,GAAG,SAAI,EAAE,MAAM,SAAK;CAwCvF"}
package/dist/table.js CHANGED
@@ -1,16 +1,13 @@
1
1
  import { AT, C, CenterText, Dragger, F, KeyBinder, ParamGUI, S, ScaleableContainer, stime } from "@thegraid/easeljs-lib";
2
2
  import { Container, EventDispatcher, Graphics, Shape, Text } from "@thegraid/easeljs-module";
3
- import { NamedContainer } from "./game-play";
3
+ import { EBC, PidChoice } from "./choosers";
4
+ import { NamedContainer, TileEvent } from "./game-play";
4
5
  import { RecycleHex } from "./hex";
5
6
  import { Player } from "./player";
6
7
  import { PlayerPanel } from "./player-panel";
7
8
  import { CircleShape, HexShape, RectShape, UtilButton } from "./shapes";
8
9
  import { playerColor0, playerColor1, TP } from "./table-params";
9
10
  import { Tile } from "./tile";
10
- import { PidChoice, EBC } from "./choosers";
11
- //import { TablePlanner } from "./planner";
12
- function firstChar(s, uc = true) { return uc ? s.substring(0, 1).toUpperCase() : s.substring(0, 1); }
13
- ;
14
11
  /** to own file... */
15
12
  class TablePlanner {
16
13
  constructor(gamePlay) { }
@@ -207,6 +204,33 @@ export class Table {
207
204
  this.hexMap.update(); // after toggleText & updateCache()
208
205
  return undefined;
209
206
  }
207
+ cacheScale = TP.cacheTiles;
208
+ /**
209
+ * re-cache all Tiles with alternate cacheScale; improves resolution at high zoom.
210
+ *
211
+ * Alternate invocations return cacheScale to 0 (un-cached)
212
+ * @param setScale [TP.cacheTiles === 0] set true to force setting, false to toggle
213
+ * @param cacheScale [max(1, scaleCont.scaleX)] set to use specific scale
214
+ */
215
+ reCacheTiles(setScale = (TP.cacheTiles === 0), cacheScale) {
216
+ this.cacheScale = cacheScale ?? Math.max(1, this.scaleCont.scaleX); // If zoomed in, use that higher scale
217
+ TP.cacheTiles = setScale ? this.cacheScale : 1; //
218
+ console.log(stime('GamePlay', `.reCacheTiles: TP.cacheTiles=`), TP.cacheTiles, this.scaleCont.scaleX);
219
+ Tile.allTiles.forEach(tile => {
220
+ const rad = tile.radius;
221
+ tile.setBounds(null, 0, 0, 0);
222
+ if (tile.cacheID) {
223
+ tile.uncache();
224
+ const { x, y, width, height } = tile.getBounds() ?? { x: -rad, y: -rad, width: 2 * rad, height: 2 * rad };
225
+ tile.setBounds(x, y, width, height);
226
+ }
227
+ else {
228
+ const { x, y, width, height } = tile.getBounds() ?? { x: -rad, y: -rad, width: 2 * rad, height: 2 * rad };
229
+ tile.cache(x, y, width, height, TP.cacheTiles);
230
+ }
231
+ });
232
+ this.hexMap.update();
233
+ }
210
234
  aiControl(color = TP.bgColor, dx = 100, rad = 16) {
211
235
  let table = this;
212
236
  // c m v on buttons
@@ -261,7 +285,7 @@ export class Table {
261
285
  }
262
286
  /**
263
287
  * all number in units of dxdc or dydr
264
- * @param x0 frame left; relative to scaleCont
288
+ * @param x0 frame left; relative to scaleCont (offset from bgRect to hexCont)
265
289
  * @param y0 frame top; relative to scaleCont
266
290
  * @param w0 pad width; width of bgRect, beyond hexCont, centered on hexCont
267
291
  * @param h0 pad height; height of bgRect, beyond hexCont, centered on hexCont
@@ -276,7 +300,7 @@ export class Table {
276
300
  const mapCont = hexMap.mapCont, hexCont = mapCont.hexCont; // local reference
277
301
  this.scaleCont.addChild(mapCont);
278
302
  // background sized for hexMap:
279
- const { width, height } = hexCont.getBounds();
303
+ const { width, height } = hexCont.getBounds(); // & .setBounds() ??
280
304
  const { dxdc, dydr } = hexMap.xywh;
281
305
  const { x, y, w, h } = { x: x0 * dxdc, y: y0 * dydr, w: width + w0 * dxdc, h: height + h0 * dydr };
282
306
  // align center of mapCont(0,0) == hexMap(center) with center of background
@@ -298,16 +322,9 @@ export class Table {
298
322
  this.bgRect = this.setBackground(this.scaleCont, xywh); // bounded by xywh
299
323
  const { x, y, width, height } = hexCont.getBounds();
300
324
  hexCont.cache(x, y, width, height); // cache hexCont (bounded by bgr)
301
- /**
302
- * After setBackground() & hexCont.cache(); before makePerPlayer();
303
- *
304
- * Whatever: make overlays, score panel, extra tracks (auction...)
305
- */
306
325
  this.layoutTable2(); // supply args (mapCont?) if necessary;
307
326
  this.makePerPlayer();
308
327
  this.setupUndoButtons(55, 60, 45, xywh); // & enableHexInspector()
309
- this.stage.on('drawend', () => setTimeout(() => this.toggleText(this.initialVis), 10), this, true);
310
- this.hexMap.update();
311
328
  this.layoutTurnlog();
312
329
  this.namedOn("playerMoveEvent", S.add, this.gamePlay.playerMoveEvent, this.gamePlay);
313
330
  }
@@ -325,29 +342,44 @@ export class Table {
325
342
  const col = (pIndex == 0 ? (icol) : (dc - icol));
326
343
  return { row, col };
327
344
  }
345
+ /**
346
+ * After setBackground() & hexCont.cache(); before makePerPlayer();
347
+ *
348
+ * Whatever: make overlays, score panel, extra tracks (auction...)
349
+ */
328
350
  layoutTable2() {
351
+ this.stage.on('drawend', () => setTimeout(() => this.toggleText(this.initialVis), 10), this, true);
352
+ this.hexMap.update();
329
353
  }
354
+ /**
355
+ * Make ParamGUI with a background RectShape, and make it dragable.
356
+ * @param makeGUI a function(Container) to create a ParamGUI
357
+ * @param name of the Container to hold the ParamGUI
358
+ * @param cx location of Container on scaleCont: cx * scale
359
+ * @param cy location of Container on scaleCont: cy * scale
360
+ * @param scale [TP.hexRad / 60] Container scaleX, scaleY
361
+ * @param d border size of background RectShape around/behind GUI Container
362
+ * @returns the gui returned from makeGUI(Table, Ccntainer)
363
+ */
330
364
  gpanel(makeGUI, name, cx, cy, scale = 1, d = 5) {
331
365
  const guiC = new NamedContainer(name, cx * scale, cy * scale);
332
366
  // const map = table.hexMap.mapCont.parent;
333
367
  this.scaleCont.addChildAt(guiC);
334
368
  guiC.scaleX = guiC.scaleY = scale;
335
- const gui = makeGUI.call(this, guiC); // @[0, 0]
336
- guiC.x -= (gui.linew + d) * scale;
369
+ const gui = makeGUI.call(this, guiC); // gui.[x,y] = [0, 0];
370
+ guiC.x -= (gui.linew + d) * scale; // Chooser-lines go to left, text to right
337
371
  const bgr = new RectShape({ x: -d, y: -d, w: gui.linew + 2 * d, h: gui.ymax + 2 * d }, 'rgb(200,200,200,.5)', '');
338
372
  guiC.addChildAt(bgr, 0);
339
373
  this.dragger.makeDragable(guiC);
340
374
  return gui;
341
375
  }
342
376
  /**
343
- * makeNetworkGUI(parent)
344
- * makeParamGUI(parent)
345
- * makeParamGUI2(parent)
346
- * makeDragable()
347
- * @param table
377
+ * makeNetworkGUI(parent) -> gui3.ymax
378
+ * makeParamGUI(parent) -> gui1.ymax
379
+ * makeParamGUI2(parent) -> gui2.ymax
348
380
  */
349
- makeGUIs() {
350
- const scaleCont = this.scaleCont, scale = TP.hexRad / 60, cx = -200, cy = 250, dy = 20;
381
+ makeGUIs(scale = TP.hexRad / 60, cx = -200, cy = 250, dy = 20) {
382
+ const scaleCont = this.scaleCont;
351
383
  let ymax = 0;
352
384
  const gui3 = this.gpanel(this.makeNetworkGUI, 'NetGUI', cx, cy + ymax, scale);
353
385
  ymax += gui3.ymax + dy;
@@ -546,13 +578,13 @@ export class Table {
546
578
  doneButton.on(S.click, this.doneClicked, this);
547
579
  actionCont.addChild(doneButton);
548
580
  // prefix advice: set text color
549
- const o_cgf = doneButton.shape.cgf;
581
+ const o_cgf = doneButton.rectShape.cgf;
550
582
  const cgf = (color) => {
551
583
  const tcolor = (C.dist(color, C.WHITE) < C.dist(color, C.black)) ? C.black : C.white;
552
584
  doneButton.label.color = tcolor;
553
585
  return o_cgf(color);
554
586
  };
555
- doneButton.shape.cgf = cgf; // invokes shape.paint(cgf) !!
587
+ doneButton.rectShape.cgf = cgf; // invokes shape.paint(cgf) !!
556
588
  return actionCont;
557
589
  }
558
590
  /** show player player score on table */
@@ -763,17 +795,23 @@ export class Table {
763
795
  }
764
796
  /**
765
797
  * All manual moves feed through this (drop & redo)
798
+ *
766
799
  * TablePlanner.logMove(); then dispatchEvent() --> gamePlay.doPlayerMove()
767
800
  *
768
801
  * New: let Ship (Drag & Drop) do this.
769
802
  */
770
803
  doTableMove(ihex) {
771
804
  }
772
- /** All moves (GUI & player) feed through this: */
773
- moveStoneToHex(ihex, sc) {
774
- // let hex = Hex.ofMap(ihex, this.hexMap)
775
- // this.hexMap.showMark(hex)
776
- // this.dispatchEvent(new HexEvent(S.add, hex, sc)) // -> GamePlay.playerMoveEvent(hex, sc)
805
+ /** All moves (GUI & plannerMove) feed through here:
806
+ *
807
+ * gamePlay listens with playerMoveEvent(TileEvent)
808
+ *
809
+ * and eventually get to Player.doPlayerMove()
810
+ */
811
+ moveTileToHex(tile, ihex) {
812
+ const hex = this.hexMap.getHex(ihex);
813
+ this.hexMap.showMark(hex);
814
+ this.disp.dispatchEvent(new TileEvent(S.add, tile, hex)); // -> GamePlay.playerMoveEvent(hex, sc)
777
815
  }
778
816
  /** default scaling-up value */
779
817
  upscale = 1.5;
@@ -784,11 +822,11 @@ export class Table {
784
822
  scaleParams = { initScale: .125, scale0: .05, scaleMax: 4, steps: 30, zscale: .20, };
785
823
  scaleCont;
786
824
  /** makeScaleableBack and setup scaleParams
787
- * @param bindkeys true if there's a GUI/user/keyboard
825
+ * @param bindkeys true if there's a GUI/user/keyboard (Canvas)
788
826
  */
789
827
  makeScaleCont(bindKeys) {
790
828
  /** scaleCont: a scalable background */
791
- const scaleC = new ScaleableContainer2(this.stage, this.scaleParams);
829
+ const scaleC = new ScaleableContainer(this.stage, this.scaleParams);
792
830
  this.dragger = new Dragger(scaleC);
793
831
  if (!!scaleC.stage.canvas) {
794
832
  // Special case of makeDragable; drag the parent of Dragger!
@@ -796,7 +834,7 @@ export class Table {
796
834
  //this.scaleUp(Dragger.dragCont, 1.7); // Items being dragged appear larger!
797
835
  }
798
836
  if (bindKeys) {
799
- this.bindKeysToScale(scaleC, "a", 436, 2);
837
+ this.bindKeysToScale(scaleC);
800
838
  this.bindKeys();
801
839
  }
802
840
  return scaleC;
@@ -829,15 +867,15 @@ export class Table {
829
867
  this.stage?.update();
830
868
  }
831
869
  /**
832
- * invoked before this.scaleC has been set
833
- * @param scaleC same Container as this.scaleC
834
- * @param char keybinding to set initial scale
835
- * @param xos x-offset of scaleC in screen coords (pre-scale)
836
- * @param yos y-offset of scaleC in screen coords (pre-scale)
837
- * @param scale0 imitial scale [.5]
870
+ * invoked before this.scaleCont has been set.
871
+ * @param scaleC the ScaleableContainer to be used
872
+ * @param isc ['a'] initial scale char, keybinding to reset to initial scale
873
+ * @param xos initial x-offset of scaleC in screen coords (pre-scale)
874
+ * @param yos initial y-offset of scaleC in screen coords (pre-scale)
875
+ * @param scale0 [.5] initial scale
838
876
  */
839
877
  // bindKeysToScale('a', scaleC, 436, 0, .5)
840
- bindKeysToScale(scaleC, char, xos, yos, scale0 = .5) {
878
+ bindKeysToScale(scaleC, isc = 'a', xos = 436, yos = 2, scale0 = .5) {
841
879
  const nsA = scale0;
842
880
  const apt = { x: xos, y: yos };
843
881
  let nsZ = 0.647; //
@@ -862,7 +900,7 @@ export class Table {
862
900
  this.stage.getObjectsUnderPoint(500, 100, 1);
863
901
  };
864
902
  // Scale-setting keystrokes:
865
- KeyBinder.keyBinder.setKey("a", { func: () => setScaleXY(nsA, apt) });
903
+ KeyBinder.keyBinder.setKey(isc, { func: () => setScaleXY(nsA, apt) });
866
904
  KeyBinder.keyBinder.setKey("z", { func: () => setScaleXY(nsZ, zpt) });
867
905
  KeyBinder.keyBinder.setKey("x", { func: () => saveScaleZ() });
868
906
  KeyBinder.keyBinder.setKey("p", { func: () => getOop(), thisArg: this });
@@ -874,9 +912,7 @@ export class Table {
874
912
  KeyBinder.keyBinder.setKey('S-ArrowRight', { thisArg: this, func: this.pan, argVal: { x: 10, y: 0 } });
875
913
  KeyBinder.keyBinder.setKey('ArrowUp', { thisArg: this, func: this.pan, argVal: { x: 0, y: -10 } });
876
914
  KeyBinder.keyBinder.setKey('ArrowDown', { thisArg: this, func: this.pan, argVal: { x: 0, y: 10 } });
877
- KeyBinder.keyBinder.dispatchChar(char);
915
+ KeyBinder.keyBinder.dispatchChar(isc);
878
916
  }
879
917
  }
880
- class ScaleableContainer2 extends ScaleableContainer {
881
- }
882
918
  //# sourceMappingURL=table.js.map