ttpg-darrell 1.0.0 → 1.0.2

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.
@@ -0,0 +1,6 @@
1
+ export * from "./locale/locale";
2
+ export * from "./layout/layout-objects";
3
+ export * from "./nsid/nsid";
4
+ export * from "./shuffle/shuffle";
5
+ export * from "./spawn/spawn";
6
+ export * from "./triggerable-multicast-delegate/triggerable-multicast-delegate";
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./locale/locale"), exports);
18
+ __exportStar(require("./layout/layout-objects"), exports);
19
+ __exportStar(require("./nsid/nsid"), exports);
20
+ __exportStar(require("./shuffle/shuffle"), exports);
21
+ __exportStar(require("./spawn/spawn"), exports);
22
+ __exportStar(require("./triggerable-multicast-delegate/triggerable-multicast-delegate"), exports);
@@ -31,6 +31,10 @@ export declare class LayoutObjects {
31
31
  * @returns {LayoutObjectsSize}
32
32
  */
33
33
  calculateChildrenSize(): LayoutObjectsSize;
34
- _calculateChildSize(child: StaticObject | LayoutObjects): LayoutObjectsSize;
34
+ static _calculateChildSize(child: StaticObject | LayoutObjects): LayoutObjectsSize;
35
35
  doLayoutAtPoint(center: Vector, yaw: number): this;
36
+ layoutLeftOf(peer: StaticObject, gap: number): this;
37
+ layoutRightOf(peer: StaticObject, gap: number): this;
38
+ layoutAbove(peer: StaticObject, gap: number): this;
39
+ layoutBelow(peer: StaticObject, gap: number): this;
36
40
  }
@@ -73,7 +73,7 @@ class LayoutObjects {
73
73
  }
74
74
  // Apply each child.
75
75
  for (const child of this._children) {
76
- const childSize = this._calculateChildSize(child);
76
+ const childSize = LayoutObjects._calculateChildSize(child);
77
77
  if (this._isVertical) {
78
78
  size.w = Math.max(size.w, childSize.w);
79
79
  size.h += childSize.h;
@@ -85,7 +85,7 @@ class LayoutObjects {
85
85
  }
86
86
  return size;
87
87
  }
88
- _calculateChildSize(child) {
88
+ static _calculateChildSize(child) {
89
89
  let childSize;
90
90
  if (child instanceof api_1.StaticObject) {
91
91
  const currentRotation = true;
@@ -124,7 +124,7 @@ class LayoutObjects {
124
124
  let left = -size.w / 2 + padLeft;
125
125
  let top = -size.h / 2 + padTop;
126
126
  for (const child of this._children) {
127
- const childSize = this._calculateChildSize(child);
127
+ const childSize = LayoutObjects._calculateChildSize(child);
128
128
  // Calculate child center (world).
129
129
  const childCenter = new api_1.Vector(top + childSize.h / 2, left + childSize.w / 2, 0)
130
130
  .rotateAngleAxis(yaw, [0, 0, 1])
@@ -147,5 +147,41 @@ class LayoutObjects {
147
147
  }
148
148
  return this;
149
149
  }
150
+ layoutLeftOf(peer, gap) {
151
+ const peerSize = LayoutObjects._calculateChildSize(peer);
152
+ const size = this.calculateSize();
153
+ const center = peer
154
+ .getPosition()
155
+ .subtract([(peerSize.w + size.w) / 2 + gap, 0, 0]);
156
+ this.doLayoutAtPoint(center, 0);
157
+ return this;
158
+ }
159
+ layoutRightOf(peer, gap) {
160
+ const peerSize = LayoutObjects._calculateChildSize(peer);
161
+ const size = this.calculateSize();
162
+ const center = peer
163
+ .getPosition()
164
+ .add([(peerSize.w + size.w) / 2 + gap, 0, 0]);
165
+ this.doLayoutAtPoint(center, 0);
166
+ return this;
167
+ }
168
+ layoutAbove(peer, gap) {
169
+ const peerSize = LayoutObjects._calculateChildSize(peer);
170
+ const size = this.calculateSize();
171
+ const center = peer
172
+ .getPosition()
173
+ .add([0, (peerSize.h + size.w) / 2 + gap, 0]);
174
+ this.doLayoutAtPoint(center, 0);
175
+ return this;
176
+ }
177
+ layoutBelow(peer, gap) {
178
+ const peerSize = LayoutObjects._calculateChildSize(peer);
179
+ const size = this.calculateSize();
180
+ const center = peer
181
+ .getPosition()
182
+ .subtract([0, (peerSize.h + size.w) / 2 + gap, 0]);
183
+ this.doLayoutAtPoint(center, 0);
184
+ return this;
185
+ }
150
186
  }
151
187
  exports.LayoutObjects = LayoutObjects;
@@ -0,0 +1,6 @@
1
+ export * from "./locale/locale";
2
+ export * from "./layout/layout-objects";
3
+ export * from "./nsid/nsid";
4
+ export * from "./shuffle/shuffle";
5
+ export * from "./spawn/spawn";
6
+ export * from "./triggerable-multicast-delegate/triggerable-multicast-delegate";
@@ -0,0 +1,6 @@
1
+ export * from "./locale/locale";
2
+ export * from "./layout/layout-objects";
3
+ export * from "./nsid/nsid";
4
+ export * from "./shuffle/shuffle";
5
+ export * from "./spawn/spawn";
6
+ export * from "./triggerable-multicast-delegate/triggerable-multicast-delegate";
@@ -31,6 +31,10 @@ export declare class LayoutObjects {
31
31
  * @returns {LayoutObjectsSize}
32
32
  */
33
33
  calculateChildrenSize(): LayoutObjectsSize;
34
- _calculateChildSize(child: StaticObject | LayoutObjects): LayoutObjectsSize;
34
+ static _calculateChildSize(child: StaticObject | LayoutObjects): LayoutObjectsSize;
35
35
  doLayoutAtPoint(center: Vector, yaw: number): this;
36
+ layoutLeftOf(peer: StaticObject, gap: number): this;
37
+ layoutRightOf(peer: StaticObject, gap: number): this;
38
+ layoutAbove(peer: StaticObject, gap: number): this;
39
+ layoutBelow(peer: StaticObject, gap: number): this;
36
40
  }
@@ -70,7 +70,7 @@ export class LayoutObjects {
70
70
  }
71
71
  // Apply each child.
72
72
  for (const child of this._children) {
73
- const childSize = this._calculateChildSize(child);
73
+ const childSize = LayoutObjects._calculateChildSize(child);
74
74
  if (this._isVertical) {
75
75
  size.w = Math.max(size.w, childSize.w);
76
76
  size.h += childSize.h;
@@ -82,7 +82,7 @@ export class LayoutObjects {
82
82
  }
83
83
  return size;
84
84
  }
85
- _calculateChildSize(child) {
85
+ static _calculateChildSize(child) {
86
86
  let childSize;
87
87
  if (child instanceof StaticObject) {
88
88
  const currentRotation = true;
@@ -121,7 +121,7 @@ export class LayoutObjects {
121
121
  let left = -size.w / 2 + padLeft;
122
122
  let top = -size.h / 2 + padTop;
123
123
  for (const child of this._children) {
124
- const childSize = this._calculateChildSize(child);
124
+ const childSize = LayoutObjects._calculateChildSize(child);
125
125
  // Calculate child center (world).
126
126
  const childCenter = new Vector(top + childSize.h / 2, left + childSize.w / 2, 0)
127
127
  .rotateAngleAxis(yaw, [0, 0, 1])
@@ -144,4 +144,40 @@ export class LayoutObjects {
144
144
  }
145
145
  return this;
146
146
  }
147
+ layoutLeftOf(peer, gap) {
148
+ const peerSize = LayoutObjects._calculateChildSize(peer);
149
+ const size = this.calculateSize();
150
+ const center = peer
151
+ .getPosition()
152
+ .subtract([(peerSize.w + size.w) / 2 + gap, 0, 0]);
153
+ this.doLayoutAtPoint(center, 0);
154
+ return this;
155
+ }
156
+ layoutRightOf(peer, gap) {
157
+ const peerSize = LayoutObjects._calculateChildSize(peer);
158
+ const size = this.calculateSize();
159
+ const center = peer
160
+ .getPosition()
161
+ .add([(peerSize.w + size.w) / 2 + gap, 0, 0]);
162
+ this.doLayoutAtPoint(center, 0);
163
+ return this;
164
+ }
165
+ layoutAbove(peer, gap) {
166
+ const peerSize = LayoutObjects._calculateChildSize(peer);
167
+ const size = this.calculateSize();
168
+ const center = peer
169
+ .getPosition()
170
+ .add([0, (peerSize.h + size.w) / 2 + gap, 0]);
171
+ this.doLayoutAtPoint(center, 0);
172
+ return this;
173
+ }
174
+ layoutBelow(peer, gap) {
175
+ const peerSize = LayoutObjects._calculateChildSize(peer);
176
+ const size = this.calculateSize();
177
+ const center = peer
178
+ .getPosition()
179
+ .subtract([0, (peerSize.h + size.w) / 2 + gap, 0]);
180
+ this.doLayoutAtPoint(center, 0);
181
+ return this;
182
+ }
147
183
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ttpg-darrell",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "TTPG TypeScript library",
5
5
  "main": "./build/cjs/index.js",
6
6
  "module": "./build/esm/index.js",