@thegraid/hexlib 1.1.0 → 1.1.4

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/dist/hex.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="easeljs" />
2
2
  /// <reference types="@thegraid/easeljs-lib/dist/createjs-functions" />
3
- import { XY } from '@thegraid/common-lib';
3
+ import { XY, XYWH } from '@thegraid/common-lib';
4
4
  import { Constructor, RC } from "@thegraid/easeljs-lib";
5
5
  import { Container, DisplayObject, Point, Text } from "@thegraid/easeljs-module";
6
6
  import { EwDir, HexDir, NsDir } from "./hex-intfs";
@@ -103,20 +103,20 @@ export declare class Hex {
103
103
  rcspString(): string;
104
104
  /** convert LINKS object to Array of Hex */
105
105
  get linkHexes(): (this | undefined)[];
106
- forEachLinkHex(func: (hex: Hex | undefined, dir: HexDir | undefined, hex0: Hex) => unknown, inclCenter?: boolean): void;
106
+ forEachLinkHex(func: (hex: this | undefined, dir: HexDir | undefined, hex0: this) => unknown, inclCenter?: boolean): void;
107
107
  /** return HexDir to the first linked hex that satisfies predicate. */
108
108
  findLinkHex(pred: (hex: this | undefined, dir: HexDir, hex0: this) => boolean): HexDir | undefined;
109
109
  /** continue in HexDir until pred is satisfied. */
110
- findInDir(dir: HexDir, pred: (hex: Hex, dir: HexDir, hex0: Hex) => boolean): Hex | undefined;
110
+ findInDir(dir: HexDir, pred: (hex: this, dir: HexDir, hex0: this) => boolean): this | undefined;
111
111
  /** array of all hexes in line from dir. */
112
112
  hexesInDir(dir: HexDir, rv?: this[]): this[];
113
113
  /** for each Hex in each Dir: func(hex, dir, this) */
114
114
  forEachHexDir(func: (hex: this, dir: HexDir, hex0: this) => unknown): void;
115
- /** from this Hex, follow links[ds], ns times. */
116
- nextHex(dir: HexDir, ns?: number): Hex | undefined;
115
+ /** from this Hex, follow links[ds], ns times (or until !links[ds]). */
116
+ nextHex(dir: HexDir, ns?: number): this | undefined;
117
117
  /** return last Hex on axis in given direction */
118
- lastHex(ds: HexDir): Hex;
119
- /** distance between Hexes: adjacent = 1, based on row, col, sqrt3 */
118
+ lastHex(ds: HexDir): this;
119
+ /** distance between Hexes: adjacent = 1, based on row, col, unit = 1 / H.sqrt3 */
120
120
  radialDist(hex: Hex): number;
121
121
  }
122
122
  /**
@@ -143,6 +143,42 @@ export declare class Hex1 extends Hex {
143
143
  * class LibHex2extendsLocalHex1 extends Hex2Mixin(LocalHex1) { }
144
144
  *
145
145
  * class LocalHex2 extends LibHex2extendsLocalHex1 { ... }
146
+ *
147
+ * https://www.typescriptlang.org/docs/handbook/mixins.html
148
+ *
149
+ *
150
+ * Note: In the compiled hex.js and its hex.d.ts,
151
+ * the type 'this' in the Hex2Mixin versions of Hex methods
152
+ * is converted to type 'any'.
153
+ * (because Hex2Mixin and Hex2_base come from new(...) but are not a class,
154
+ * therefore have no instance or this/type)
155
+ *
156
+ * To get properly typed versions in your derived class extends Hex2Mixin,
157
+ * include the following overrides:
158
+ *
159
+ * @example
160
+ override forEachLinkHex(func: (hex: this | undefined, dir: HexDir | undefined, hex0: this) => unknown, inclCenter = false) {
161
+ super.forEachLinkHex(func)
162
+ }
163
+ override findLinkHex(pred: (hex: this | undefined, dir: HexDir, hex0: this) => boolean) {
164
+ return super.findLinkHex(pred)
165
+ }
166
+ override findInDir(dir: HexDir, pred: (hex: this, dir: HexDir, hex0: this) => boolean): this | undefined {
167
+ return super.findInDir(dir, pred)
168
+ }
169
+ override hexesInDir(dir: HexDir, rv: this[] = []): this[] {
170
+ return super.hexesInDir(dir, rv)
171
+ }
172
+ override forEachHexDir(func: (hex: this, dir: HexDir, hex0: this) => unknown) {
173
+ super.forEachHexDir(func);
174
+ }
175
+ override nextHex(dir: HexDir, ns: number = 1): this | undefined {
176
+ return super.nextHex(dir, ns) as this | undefined;
177
+ }
178
+ override lastHex(ds: HexDir): this {
179
+ return super.lastHex(ds)
180
+ }
181
+ *
146
182
  */
147
183
  export declare function Hex2Mixin<TBase extends Constructor<Hex1>>(Base: TBase): {
148
184
  new (...args: any[]): {
@@ -179,11 +215,13 @@ export declare function Hex2Mixin<TBase extends Constructor<Hex1>>(Base: TBase):
179
215
  setHexColor(color: string, district?: number | undefined): void;
180
216
  /** unit distance between Hexes: adjacent = 1; see also: radialDist */
181
217
  metricDist(hex: Hex): number;
182
- /** location of corner between dir0 and dir1; in parent coordinates.
183
- * @param dir0 an EwDir
184
- * @param dir1 an EwDir
218
+ /** Location of corner between dir0 and dir1; in parent coordinates.
219
+ * @param dir0 a HexDir
220
+ * @param dir1 a HexDir
221
+ * @param point [new Point()] set location-x,y in point and return it.
222
+ * @param rad [this.radius]
185
223
  */
186
- cornerPoint(dir0: HexDir, dir1: HexDir): Point;
224
+ cornerPoint(dir0: HexDir, dir1: HexDir, point?: Point, rad?: number): Point;
187
225
  /** Location of edge point in dir; in parent coordinates.
188
226
  * @param dir indicates direction to edge
189
227
  * @param rad [1] per-unit distance from center: 0 --> center, 1 --> exactly on edge, 1+ --> outside hex
@@ -246,20 +284,20 @@ export declare function Hex2Mixin<TBase extends Constructor<Hex1>>(Base: TBase):
246
284
  readonly linkDirs: HexDir[];
247
285
  /** convert LINKS object to Array of Hex */
248
286
  readonly linkHexes: (any | undefined)[];
249
- forEachLinkHex(func: (hex: Hex | undefined, dir: HexDir | undefined, hex0: Hex) => unknown, inclCenter?: boolean): void;
287
+ forEachLinkHex(func: (hex: any | undefined, dir: HexDir | undefined, hex0: any) => unknown, inclCenter?: boolean): void;
250
288
  /** return HexDir to the first linked hex that satisfies predicate. */
251
289
  findLinkHex(pred: (hex: any | undefined, dir: HexDir, hex0: any) => boolean): HexDir | undefined;
252
290
  /** continue in HexDir until pred is satisfied. */
253
- findInDir(dir: HexDir, pred: (hex: Hex, dir: HexDir, hex0: Hex) => boolean): Hex | undefined;
291
+ findInDir(dir: HexDir, pred: (hex: any, dir: HexDir, hex0: any) => boolean): any | undefined;
254
292
  /** array of all hexes in line from dir. */
255
293
  hexesInDir(dir: HexDir, rv?: any[]): any[];
256
294
  /** for each Hex in each Dir: func(hex, dir, this) */
257
295
  forEachHexDir(func: (hex: any, dir: HexDir, hex0: any) => unknown): void;
258
- /** from this Hex, follow links[ds], ns times. */
259
- nextHex(dir: HexDir, ns?: number): Hex | undefined;
296
+ /** from this Hex, follow links[ds], ns times (or until !links[ds]). */
297
+ nextHex(dir: HexDir, ns?: number): any | undefined;
260
298
  /** return last Hex on axis in given direction */
261
- lastHex(ds: HexDir): Hex;
262
- /** distance between Hexes: adjacent = 1, based on row, col, sqrt3 */
299
+ lastHex(ds: HexDir): any;
300
+ /** distance between Hexes: adjacent = 1, based on row, col, unit = 1 / H.sqrt3 */
263
301
  radialDist(hex: Hex): number;
264
302
  };
265
303
  } & TBase;
@@ -298,11 +336,13 @@ declare const Hex2_base: {
298
336
  setHexColor(color: string, district?: number | undefined): void;
299
337
  /** unit distance between Hexes: adjacent = 1; see also: radialDist */
300
338
  metricDist(hex: Hex): number;
301
- /** location of corner between dir0 and dir1; in parent coordinates.
302
- * @param dir0 an EwDir
303
- * @param dir1 an EwDir
339
+ /** Location of corner between dir0 and dir1; in parent coordinates.
340
+ * @param dir0 a HexDir
341
+ * @param dir1 a HexDir
342
+ * @param point [new Point()] set location-x,y in point and return it.
343
+ * @param rad [this.radius]
304
344
  */
305
- cornerPoint(dir0: HexDir, dir1: HexDir): Point;
345
+ cornerPoint(dir0: HexDir, dir1: HexDir, point?: Point, rad?: number): Point;
306
346
  /** Location of edge point in dir; in parent coordinates.
307
347
  * @param dir indicates direction to edge
308
348
  * @param rad [1] per-unit distance from center: 0 --> center, 1 --> exactly on edge, 1+ --> outside hex
@@ -365,20 +405,20 @@ declare const Hex2_base: {
365
405
  readonly linkDirs: HexDir[];
366
406
  /** convert LINKS object to Array of Hex */
367
407
  readonly linkHexes: (any | undefined)[];
368
- forEachLinkHex(func: (hex: Hex | undefined, dir: HexDir | undefined, hex0: Hex) => unknown, inclCenter?: boolean): void;
408
+ forEachLinkHex(func: (hex: any | undefined, dir: HexDir | undefined, hex0: any) => unknown, inclCenter?: boolean): void;
369
409
  /** return HexDir to the first linked hex that satisfies predicate. */
370
410
  findLinkHex(pred: (hex: any | undefined, dir: HexDir, hex0: any) => boolean): HexDir | undefined;
371
411
  /** continue in HexDir until pred is satisfied. */
372
- findInDir(dir: HexDir, pred: (hex: Hex, dir: HexDir, hex0: Hex) => boolean): Hex | undefined;
412
+ findInDir(dir: HexDir, pred: (hex: any, dir: HexDir, hex0: any) => boolean): any | undefined;
373
413
  /** array of all hexes in line from dir. */
374
414
  hexesInDir(dir: HexDir, rv?: any[]): any[];
375
415
  /** for each Hex in each Dir: func(hex, dir, this) */
376
416
  forEachHexDir(func: (hex: any, dir: HexDir, hex0: any) => unknown): void;
377
- /** from this Hex, follow links[ds], ns times. */
378
- nextHex(dir: HexDir, ns?: number): Hex | undefined;
417
+ /** from this Hex, follow links[ds], ns times (or until !links[ds]). */
418
+ nextHex(dir: HexDir, ns?: number): any | undefined;
379
419
  /** return last Hex on axis in given direction */
380
- lastHex(ds: HexDir): Hex;
381
- /** distance between Hexes: adjacent = 1, based on row, col, sqrt3 */
420
+ lastHex(ds: HexDir): any;
421
+ /** distance between Hexes: adjacent = 1, based on row, col, unit = 1 / H.sqrt3 */
382
422
  radialDist(hex: Hex): number;
383
423
  };
384
424
  } & typeof Hex1;
@@ -446,34 +486,49 @@ export interface HexM<T extends Hex> {
446
486
  readonly district: T[][];
447
487
  readonly mapCont: MapCont;
448
488
  rcLinear(row: number, col: number): number;
449
- forEachHex<K extends T>(fn: (hex: K) => void): void;
489
+ forEachHex(fn: (hex: T) => void): void;
450
490
  update(): void;
451
491
  showMark(hex?: T): void;
492
+ radius: number;
493
+ centerHex: T;
494
+ xywh: XYWH & {
495
+ dxdc: number;
496
+ dydr: number;
497
+ };
498
+ hexC: Constructor<Hex>;
499
+ hexUnderObj(dragObj: DisplayObject, legalOnly?: boolean): T | undefined;
452
500
  }
453
501
  /**
454
- * Collection of Hex *and* Graphics-Containers for Hex2
455
- * districts: Hex[]
502
+ * 2-D Array[row][col]: Hex; plus a mapCont of Graphics-Containers for IHex2.
503
+ *
504
+ * hexAry[n]: all the Hex (or IHex2) elements.
456
505
  *
457
- * HexMap[row][col]: Hex or Hex2 elements.
458
- * If mapCont is set, then populate with Hex2
506
+ * district[i]: Hex[]; all the Hex in a given district.
459
507
  *
460
508
  * (TP.mh X TP.nh) hexes in districts;
461
509
  *
462
- * With a Mark and off-map: skipHex & resignHex
510
+ * Use addToMapCont(hexC), to populate with new hexC()
511
+ *
512
+ * mark: a HexMark to visually indicate a selected IHex2.
463
513
  *
464
514
  */
465
515
  export declare class HexMap<T extends Hex> extends Array<Array<T>> implements HexM<T> {
466
- hexC: HexConstructor<Hex>;
516
+ hexC: Constructor<Hex>;
467
517
  Aname: string;
518
+ /** A color for each District: 'rgb(198,198,198)' */
468
519
  static readonly distColor: string[];
469
520
  /**
470
- * HexMap: TP.nRows X TP.nCols hexes.
521
+ * HexMap: TP.nRows X TP.nCols of Hex [new hexC()]
471
522
  *
472
- * Basic map is non-GUI, addToMapCont uses Hex2 elements to enable GUI interaction.
473
- * @param addToMapCont use Hex2 for Hex, make Containers: hexCont, infCont, markCont, stoneCont
474
- * @param hexC Constructor<T> for the Hex elements (typed as HexConstructor<Hex> for Typescript...)
523
+ * Basic map is non-GUI, addToMapCont(hexC) makes IHex2 elements to enable GUI interaction.
524
+ * Use hexC() to make Hex; mapCont has layers of Containers per HexMap.cNames;
525
+ *
526
+ * @param radius [TP.hexRad] typically 60
527
+ * @param addToMapCont [false] set true to include addToMapCont(hexC)
528
+ * @param hexC [Hex] HexConstructor\<Hex\> for each element
529
+ * @param Aname ['mainMap'] a name for debugger
475
530
  */
476
- constructor(radius?: number, addToMapCont?: boolean, hexC?: HexConstructor<Hex>, Aname?: string);
531
+ constructor(radius?: number, addToMapCont?: boolean, hexC?: Constructor<Hex>, Aname?: string);
477
532
  /** may be obsolete when using IHex2 */
478
533
  get asIHex2Map(): HexMap<PublicInterface<Hex2>>;
479
534
  /** Each occupied Hex, with the associated district color */
@@ -500,7 +555,7 @@ export declare class HexMap<T extends Hex> extends Array<Array<T>> implements He
500
555
  };
501
556
  get centerHex(): T;
502
557
  get nRowCol(): number[];
503
- getCornerHex(dn: HexDir): Hex;
558
+ getCornerHex(dn: HexDir): T;
504
559
  rcLinear(row: number, col: number): number;
505
560
  mark: HexMark | undefined;
506
561
  makeMark(): HexMark;
@@ -537,12 +592,15 @@ export declare class HexMap<T extends Hex> extends Array<Array<T>> implements He
537
592
  /** link hex to/from each extant neighor */
538
593
  link(hex: T, rc?: RC, map?: T[][], nt?: Topo, lf?: (hex: T) => LINKS<T>): void;
539
594
  /**
540
- * The [Legal] Hex (LegalMark.hex2) under the given x,y coordinates.
541
- * If on the line, then the top (last drawn) Hex.
595
+ * Return the Hex under the given x,y coordinates.
596
+ *
597
+ * Conceptually: (legal ? LegalMark : HexCont)?.hex2 as \<T extends IHex2\>;
598
+ *
599
+ * If multiple HexCont at x,y, return the top (last drawn) HexCont.
542
600
  * @param x in local coordinates of this HexMap.mapCont
543
601
  * @param y
544
- * @param legal - returnn ONLY hex with LegalMark visible & mouseenabled.
545
- * @returns the Hex2 under mouse or undefined, if not a Hex (background)
602
+ * @param legal - return ONLY a Hex with LegalMark visible & mouseenabled.
603
+ * @returns the IHex2 of the LegalMark or HexCont at the given point (or undefined if no such HexCont)
546
604
  */
547
605
  hexUnderPoint(x: number, y: number, legal?: boolean): T | undefined;
548
606
  private _nh;
@@ -566,7 +624,10 @@ export declare class HexMap<T extends Hex> extends Array<Array<T>> implements He
566
624
  /**
567
625
  * overridable action for makeAllDistricts;
568
626
  *
569
- * Base implementation invokes makeMetaDistrict(nh, mh, rc0)
627
+ * Base implementation invokes makeMetaHexRings(nh, mh, rc0)
628
+ *
629
+ * Alterative: makeRect(nrow, ncol, ...)
630
+ *
570
631
  * @param nh
571
632
  * @param mh
572
633
  * @param rc0
@@ -575,6 +636,11 @@ export declare class HexMap<T extends Hex> extends Array<Array<T>> implements He
575
636
  makeAllHexes(nh: number | undefined, mh: number | undefined, rc0: RC): T[];
576
637
  /**
577
638
  * Make the center district, then make (mh-1) rings other meta-hex districts.
639
+ *
640
+ * Spiral clockwise from center, placing a line of meta-hex [using makeMetaHex()].
641
+ *
642
+ * MakeMetaHex likewise spirals from center, placing a line of Hex.
643
+ *
578
644
  * @param nh order [number of 'rings'] of meta-hexes (2 or 3 for this game) [TP.mHexes]
579
645
  * @param mh size ['rings' in each meta-hex] of meta-hex (1..6) [TP.nHexes]
580
646
  * @param rc0 location of initial, central Hex
package/dist/hex.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hex.d.ts","sourceRoot":"","sources":["../src/hex.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAiB,WAAW,EAAK,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEjF,OAAO,EAAE,KAAK,EAAK,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE5C,eAAO,MAAM,QAAQ,eAAe,CAAA;AACpC,eAAO,MAAM,MAAM,cAAc,CAAA;AACjC,oFAAoF;AACpF,MAAM,MAAM,KAAK,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/D,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,GAAG,IAAI,KAAK,GAAG,EAAE,MA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0D;IAC1D,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM;IAalC;;;OAGG;IACH,mBAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,QAAQ,SAAI;IAO7C;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,SAAI,EAAE,IAAI,UAAgC,EAAE,MAAM,GAAE,CAAC,EAAO,GAAG,CAAC,EAAE;IAoBvG;;;;;;;;OAQG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,SAAI;IAM5F;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAQ;IAQhE;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,sBAAgB,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI;CAOnF;AAED,gDAAgD;AAChD,qBAAa,OAAQ,SAAQ,MAAM,CAAC,GAAG,CAAC;CAEvC"}
package/dist/hex.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { C, CenterText, F } from "@thegraid/easeljs-lib";
2
2
  import { Container, Point } from "@thegraid/easeljs-module";
3
+ import { NamedContainer } from "./game-play";
3
4
  import { H } from "./hex-intfs";
4
5
  import { HexShape, LegalMark } from "./shapes";
5
6
  import { TP } from "./table-params";
@@ -141,10 +142,10 @@ export class Hex {
141
142
  forEachHexDir(func) {
142
143
  this.linkDirs.forEach((dir) => this.hexesInDir(dir).filter(hex => !!hex).map(hex => func(hex, dir, this)));
143
144
  }
144
- /** from this Hex, follow links[ds], ns times. */
145
+ /** from this Hex, follow links[ds], ns times (or until !links[ds]). */
145
146
  nextHex(dir, ns = 1) {
146
147
  let hex = this;
147
- while (!!(hex = hex.links[dir]) && --ns > 0) { }
148
+ while (ns-- > 0 && !!(hex = hex.links[dir])) { }
148
149
  return hex;
149
150
  }
150
151
  /** return last Hex on axis in given direction */
@@ -155,7 +156,7 @@ export class Hex {
155
156
  }
156
157
  return hex;
157
158
  }
158
- /** distance between Hexes: adjacent = 1, based on row, col, sqrt3 */
159
+ /** distance between Hexes: adjacent = 1, based on row, col, unit = 1 / H.sqrt3 */
159
160
  radialDist(hex) {
160
161
  let unit = 1 / H.sqrt3; // so w = delta(col) = 1
161
162
  let { x: tx, y: ty } = this.xywh(unit), { x: hx, y: hy } = hex.xywh(unit);
@@ -192,6 +193,42 @@ export class Hex1 extends Hex {
192
193
  * class LibHex2extendsLocalHex1 extends Hex2Mixin(LocalHex1) { }
193
194
  *
194
195
  * class LocalHex2 extends LibHex2extendsLocalHex1 { ... }
196
+ *
197
+ * https://www.typescriptlang.org/docs/handbook/mixins.html
198
+ *
199
+ *
200
+ * Note: In the compiled hex.js and its hex.d.ts,
201
+ * the type 'this' in the Hex2Mixin versions of Hex methods
202
+ * is converted to type 'any'.
203
+ * (because Hex2Mixin and Hex2_base come from new(...) but are not a class,
204
+ * therefore have no instance or this/type)
205
+ *
206
+ * To get properly typed versions in your derived class extends Hex2Mixin,
207
+ * include the following overrides:
208
+ *
209
+ * @example
210
+ override forEachLinkHex(func: (hex: this | undefined, dir: HexDir | undefined, hex0: this) => unknown, inclCenter = false) {
211
+ super.forEachLinkHex(func)
212
+ }
213
+ override findLinkHex(pred: (hex: this | undefined, dir: HexDir, hex0: this) => boolean) {
214
+ return super.findLinkHex(pred)
215
+ }
216
+ override findInDir(dir: HexDir, pred: (hex: this, dir: HexDir, hex0: this) => boolean): this | undefined {
217
+ return super.findInDir(dir, pred)
218
+ }
219
+ override hexesInDir(dir: HexDir, rv: this[] = []): this[] {
220
+ return super.hexesInDir(dir, rv)
221
+ }
222
+ override forEachHexDir(func: (hex: this, dir: HexDir, hex0: this) => unknown) {
223
+ super.forEachHexDir(func);
224
+ }
225
+ override nextHex(dir: HexDir, ns: number = 1): this | undefined {
226
+ return super.nextHex(dir, ns) as this | undefined;
227
+ }
228
+ override lastHex(ds: HexDir): this {
229
+ return super.lastHex(ds)
230
+ }
231
+ *
195
232
  */
196
233
  export function Hex2Mixin(Base) {
197
234
  return class Hex2Impl extends Base {
@@ -324,18 +361,21 @@ export function Hex2Mixin(Base) {
324
361
  let dx = tx - hx, dy = ty - hy;
325
362
  return Math.sqrt(dx * dx + dy * dy); // tw == H.sqrt3
326
363
  }
327
- /** location of corner between dir0 and dir1; in parent coordinates.
328
- * @param dir0 an EwDir
329
- * @param dir1 an EwDir
364
+ /** Location of corner between dir0 and dir1; in parent coordinates.
365
+ * @param dir0 a HexDir
366
+ * @param dir1 a HexDir
367
+ * @param point [new Point()] set location-x,y in point and return it.
368
+ * @param rad [this.radius]
330
369
  */
331
- // hexmarket uses to find ewDir corner between two nsDir edges.
332
- cornerPoint(dir0, dir1) {
333
- const d0 = H.ewDirRot[dir0], d1 = H.ewDirRot[dir1];
334
- let a2 = (d0 + d1) / 2, h = this.radius;
370
+ cornerPoint(dir0, dir1, point = new Point(), rad = this.radius) {
371
+ const d0 = H.dirRot[dir0], d1 = H.dirRot[dir1];
372
+ let a2 = (d0 + d1) / 2;
335
373
  if (Math.abs(d0 - d1) > 180)
336
374
  a2 += 180;
337
- let a = a2 * H.degToRadians;
338
- return new Point(this.x + Math.sin(a) * h, this.y - Math.cos(a) * h);
375
+ const a = a2 * H.degToRadians;
376
+ point.x = this.x + Math.sin(a) * rad;
377
+ point.y = this.y - Math.cos(a) * rad;
378
+ return point;
339
379
  }
340
380
  /** Location of edge point in dir; in parent coordinates.
341
381
  * @param dir indicates direction to edge
@@ -343,9 +383,9 @@ export function Hex2Mixin(Base) {
343
383
  * @param point [new Point()] set location-x,y in point and return it.
344
384
  */
345
385
  edgePoint(dir, rad = 1, point = new Point()) {
346
- const a = H.nsDirRot[dir] * H.degToRadians, h = rad * this.radius * H.sqrt3_2;
347
- point.x = this.hexShape.x + Math.sin(a) * h;
348
- point.y = this.hexShape.y - Math.cos(a) * h;
386
+ const a = H.dirRot[dir] * H.degToRadians, h = rad * this.radius * H.sqrt3_2;
387
+ point.x = this.x + Math.sin(a) * h;
388
+ point.y = this.y - Math.cos(a) * h;
349
389
  return point;
350
390
  }
351
391
  };
@@ -372,7 +412,7 @@ export class HexMark extends HexShape {
372
412
  this.graphics.f(cm).dp(0, 0, this.radius, 6, 0, this.tilt);
373
413
  this.cache(-radius, -radius, 2 * radius, 2 * radius);
374
414
  this.graphics.c().f(C.BLACK).dc(0, 0, radius0);
375
- this.updateCache("destination-out");
415
+ this.updateCache('destination-out');
376
416
  this.setHexBounds(); // bounds are based on readonly, should be const
377
417
  this.mouseEnabled = false;
378
418
  }
@@ -429,10 +469,9 @@ export class MapCont extends Container {
429
469
  /** add all the layers of Containers. update this.cNames */
430
470
  addContainers(cNames = this.cNames) {
431
471
  this._cNames = cNames.concat();
432
- this.removeAllChildren();
472
+ this.removeAllChildren(); // TODO: remove all the field references also
433
473
  this.cNames.forEach(cname => {
434
- const cont = new Container();
435
- cont.Aname = cont.name = cname;
474
+ const cont = new NamedContainer(cname);
436
475
  this[cname] = cont;
437
476
  this.addChild(cont);
438
477
  });
@@ -457,28 +496,34 @@ export class MapCont extends Container {
457
496
  }
458
497
  }
459
498
  /**
460
- * Collection of Hex *and* Graphics-Containers for Hex2
461
- * districts: Hex[]
499
+ * 2-D Array[row][col]: Hex; plus a mapCont of Graphics-Containers for IHex2.
500
+ *
501
+ * hexAry[n]: all the Hex (or IHex2) elements.
462
502
  *
463
- * HexMap[row][col]: Hex or Hex2 elements.
464
- * If mapCont is set, then populate with Hex2
503
+ * district[i]: Hex[]; all the Hex in a given district.
465
504
  *
466
505
  * (TP.mh X TP.nh) hexes in districts;
467
506
  *
468
- * With a Mark and off-map: skipHex & resignHex
507
+ * Use addToMapCont(hexC), to populate with new hexC()
508
+ *
509
+ * mark: a HexMark to visually indicate a selected IHex2.
469
510
  *
470
511
  */
471
512
  export class HexMap extends Array {
472
513
  hexC;
473
514
  Aname;
474
- // A color for each District: 'rgb(198,198,198)'
475
- static distColor = ['lightgrey', "limegreen", "deepskyblue", "rgb(255,165,0)", "violet", "rgb(250,80,80)", "yellow"];
515
+ /** A color for each District: 'rgb(198,198,198)' */
516
+ static distColor = ['lightgrey', 'limegreen', 'deepskyblue', 'rgb(255,165,0)', 'violet', 'rgb(250,80,80)', 'yellow'];
476
517
  /**
477
- * HexMap: TP.nRows X TP.nCols hexes.
518
+ * HexMap: TP.nRows X TP.nCols of Hex [new hexC()]
519
+ *
520
+ * Basic map is non-GUI, addToMapCont(hexC) makes IHex2 elements to enable GUI interaction.
521
+ * Use hexC() to make Hex; mapCont has layers of Containers per HexMap.cNames;
478
522
  *
479
- * Basic map is non-GUI, addToMapCont uses Hex2 elements to enable GUI interaction.
480
- * @param addToMapCont use Hex2 for Hex, make Containers: hexCont, infCont, markCont, stoneCont
481
- * @param hexC Constructor<T> for the Hex elements (typed as HexConstructor<Hex> for Typescript...)
523
+ * @param radius [TP.hexRad] typically 60
524
+ * @param addToMapCont [false] set true to include addToMapCont(hexC)
525
+ * @param hexC [Hex] HexConstructor\<Hex\> for each element
526
+ * @param Aname ['mainMap'] a name for debugger
482
527
  */
483
528
  constructor(radius = TP.hexRad, addToMapCont = false, hexC = Hex, Aname = 'mainMap') {
484
529
  super(); // Array<Array<Hex>>()
@@ -664,16 +709,19 @@ export class HexMap extends Array {
664
709
  });
665
710
  }
666
711
  /**
667
- * The [Legal] Hex (LegalMark.hex2) under the given x,y coordinates.
668
- * If on the line, then the top (last drawn) Hex.
712
+ * Return the Hex under the given x,y coordinates.
713
+ *
714
+ * Conceptually: (legal ? LegalMark : HexCont)?.hex2 as \<T extends IHex2\>;
715
+ *
716
+ * If multiple HexCont at x,y, return the top (last drawn) HexCont.
669
717
  * @param x in local coordinates of this HexMap.mapCont
670
718
  * @param y
671
- * @param legal - returnn ONLY hex with LegalMark visible & mouseenabled.
672
- * @returns the Hex2 under mouse or undefined, if not a Hex (background)
719
+ * @param legal - return ONLY a Hex with LegalMark visible & mouseenabled.
720
+ * @returns the IHex2 of the LegalMark or HexCont at the given point (or undefined if no such HexCont)
673
721
  */
674
722
  hexUnderPoint(x, y, legal = true) {
675
723
  const mark = this.mapCont.markCont.getObjectUnderPoint(x, y, 1);
676
- // Note: in theory, mark could be on a Hex2 that is NOT in hexCont!
724
+ // Note: in theory, mark could be on a IHex2 that is NOT in hexCont!
677
725
  if (mark instanceof LegalMark)
678
726
  return mark.hex2;
679
727
  if (legal)
@@ -712,13 +760,15 @@ export class HexMap extends Array {
712
760
  this.setSize(nh, mh);
713
761
  const rc0 = this.calculateRC0();
714
762
  const hexAry = this.hexAry = this.makeAllHexes(nh, mh, rc0); // nh hexes on outer ring; single meta-hex
715
- this.mapCont.hexCont && this.mapCont.centerContainers();
716
763
  return hexAry;
717
764
  }
718
765
  /**
719
766
  * overridable action for makeAllDistricts;
720
767
  *
721
- * Base implementation invokes makeMetaDistrict(nh, mh, rc0)
768
+ * Base implementation invokes makeMetaHexRings(nh, mh, rc0)
769
+ *
770
+ * Alterative: makeRect(nrow, ncol, ...)
771
+ *
722
772
  * @param nh
723
773
  * @param mh
724
774
  * @param rc0
@@ -729,6 +779,11 @@ export class HexMap extends Array {
729
779
  }
730
780
  /**
731
781
  * Make the center district, then make (mh-1) rings other meta-hex districts.
782
+ *
783
+ * Spiral clockwise from center, placing a line of meta-hex [using makeMetaHex()].
784
+ *
785
+ * MakeMetaHex likewise spirals from center, placing a line of Hex.
786
+ *
732
787
  * @param nh order [number of 'rings'] of meta-hexes (2 or 3 for this game) [TP.mHexes]
733
788
  * @param mh size ['rings' in each meta-hex] of meta-hex (1..6) [TP.nHexes]
734
789
  * @param rc0 location of initial, central Hex