ttpg-darrell 1.0.11 → 1.0.13

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.
@@ -191,9 +191,10 @@ class LayoutObjects {
191
191
  .add(center);
192
192
  // Position child.
193
193
  if (child instanceof api_1.GameObject) {
194
+ childCenter.z = api_1.world.getTableHeight() + 20;
194
195
  child.setPosition(childCenter);
195
196
  child.setRotation(child.getRotation().compose([0, yaw, 0]));
196
- child.snapToGround();
197
+ child.snapToGround(); // after-layout might adjust based on this position!
197
198
  }
198
199
  else {
199
200
  child.doLayoutAtPoint(childCenter, yaw);
@@ -217,7 +218,7 @@ class LayoutObjects {
217
218
  const size = this.calculateSize();
218
219
  const center = peer
219
220
  .getPosition()
220
- .subtract([(peerSize.w + size.w) / 2 + gap, 0, 0]);
221
+ .subtract([0, (peerSize.w + size.w) / 2 + gap, 0]);
221
222
  this.doLayoutAtPoint(center, 0);
222
223
  return this;
223
224
  }
@@ -226,7 +227,7 @@ class LayoutObjects {
226
227
  const size = this.calculateSize();
227
228
  const center = peer
228
229
  .getPosition()
229
- .add([(peerSize.w + size.w) / 2 + gap, 0, 0]);
230
+ .add([0, (peerSize.w + size.w) / 2 + gap, 0]);
230
231
  this.doLayoutAtPoint(center, 0);
231
232
  return this;
232
233
  }
@@ -235,7 +236,7 @@ class LayoutObjects {
235
236
  const size = this.calculateSize();
236
237
  const center = peer
237
238
  .getPosition()
238
- .add([0, (peerSize.h + size.w) / 2 + gap, 0]);
239
+ .add([(peerSize.h + size.h) / 2 + gap, 0, 0]);
239
240
  this.doLayoutAtPoint(center, 0);
240
241
  return this;
241
242
  }
@@ -244,7 +245,7 @@ class LayoutObjects {
244
245
  const size = this.calculateSize();
245
246
  const center = peer
246
247
  .getPosition()
247
- .subtract([0, (peerSize.h + size.w) / 2 + gap, 0]);
248
+ .subtract([(peerSize.h + size.h) / 2 + gap, 0, 0]);
248
249
  this.doLayoutAtPoint(center, 0);
249
250
  return this;
250
251
  }
@@ -1,4 +1,4 @@
1
- import { GameObject, HorizontalAlignment, Vector, VerticalAlignment, } from "@tabletop-playground/api";
1
+ import { GameObject, HorizontalAlignment, Vector, VerticalAlignment, world, } from "@tabletop-playground/api";
2
2
  import { TriggerableMulticastDelegate } from "../../triggerable-multicast-delegate/triggerable-multicast-delegate";
3
3
  export class LayoutObjects {
4
4
  constructor() {
@@ -188,9 +188,10 @@ export class LayoutObjects {
188
188
  .add(center);
189
189
  // Position child.
190
190
  if (child instanceof GameObject) {
191
+ childCenter.z = world.getTableHeight() + 20;
191
192
  child.setPosition(childCenter);
192
193
  child.setRotation(child.getRotation().compose([0, yaw, 0]));
193
- child.snapToGround();
194
+ child.snapToGround(); // after-layout might adjust based on this position!
194
195
  }
195
196
  else {
196
197
  child.doLayoutAtPoint(childCenter, yaw);
@@ -214,7 +215,7 @@ export class LayoutObjects {
214
215
  const size = this.calculateSize();
215
216
  const center = peer
216
217
  .getPosition()
217
- .subtract([(peerSize.w + size.w) / 2 + gap, 0, 0]);
218
+ .subtract([0, (peerSize.w + size.w) / 2 + gap, 0]);
218
219
  this.doLayoutAtPoint(center, 0);
219
220
  return this;
220
221
  }
@@ -223,7 +224,7 @@ export class LayoutObjects {
223
224
  const size = this.calculateSize();
224
225
  const center = peer
225
226
  .getPosition()
226
- .add([(peerSize.w + size.w) / 2 + gap, 0, 0]);
227
+ .add([0, (peerSize.w + size.w) / 2 + gap, 0]);
227
228
  this.doLayoutAtPoint(center, 0);
228
229
  return this;
229
230
  }
@@ -232,7 +233,7 @@ export class LayoutObjects {
232
233
  const size = this.calculateSize();
233
234
  const center = peer
234
235
  .getPosition()
235
- .add([0, (peerSize.h + size.w) / 2 + gap, 0]);
236
+ .add([(peerSize.h + size.h) / 2 + gap, 0, 0]);
236
237
  this.doLayoutAtPoint(center, 0);
237
238
  return this;
238
239
  }
@@ -241,7 +242,7 @@ export class LayoutObjects {
241
242
  const size = this.calculateSize();
242
243
  const center = peer
243
244
  .getPosition()
244
- .subtract([0, (peerSize.h + size.w) / 2 + gap, 0]);
245
+ .subtract([(peerSize.h + size.h) / 2 + gap, 0, 0]);
245
246
  this.doLayoutAtPoint(center, 0);
246
247
  return this;
247
248
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ttpg-darrell",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "TTPG TypeScript library",
5
5
  "main": "./build/cjs/index.js",
6
6
  "module": "./build/esm/index.js",