@blorkfield/overlay-core 0.5.5 → 0.5.7

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/index.d.cts CHANGED
@@ -31,11 +31,22 @@ interface FloorConfig {
31
31
  */
32
32
  threshold?: number | number[];
33
33
  /**
34
- * Thickness of floor segments in pixels:
34
+ * Thickness of floor segments in pixels (collision body height):
35
35
  * - number: Same thickness for all segments (default: 50)
36
36
  * - number[]: Per-segment thickness (segment 0 uses value[0], etc.)
37
37
  */
38
38
  thickness?: number | number[];
39
+ /**
40
+ * Visible thickness of floor segments in pixels.
41
+ * When set, only this many pixels are visible above the canvas bottom,
42
+ * while the remaining (thickness - visibleThickness) extends below as hidden collision.
43
+ * - number: Same visible thickness for all segments (default: same as thickness)
44
+ * - number[]: Per-segment visible thickness (segment 0 uses value[0], etc.)
45
+ *
46
+ * Example: thickness=15, visibleThickness=2 creates a 15px collision body
47
+ * but only shows 2px, with 13px of hidden collision below the canvas.
48
+ */
49
+ visibleThickness?: number | number[];
39
50
  /**
40
51
  * Color of floor segments (visible when set):
41
52
  * - string: Same color for all segments
package/dist/index.d.ts CHANGED
@@ -31,11 +31,22 @@ interface FloorConfig {
31
31
  */
32
32
  threshold?: number | number[];
33
33
  /**
34
- * Thickness of floor segments in pixels:
34
+ * Thickness of floor segments in pixels (collision body height):
35
35
  * - number: Same thickness for all segments (default: 50)
36
36
  * - number[]: Per-segment thickness (segment 0 uses value[0], etc.)
37
37
  */
38
38
  thickness?: number | number[];
39
+ /**
40
+ * Visible thickness of floor segments in pixels.
41
+ * When set, only this many pixels are visible above the canvas bottom,
42
+ * while the remaining (thickness - visibleThickness) extends below as hidden collision.
43
+ * - number: Same visible thickness for all segments (default: same as thickness)
44
+ * - number[]: Per-segment visible thickness (segment 0 uses value[0], etc.)
45
+ *
46
+ * Example: thickness=15, visibleThickness=2 creates a 15px collision body
47
+ * but only shows 2px, with 13px of hidden collision below the canvas.
48
+ */
49
+ visibleThickness?: number | number[];
39
50
  /**
40
51
  * Color of floor segments (visible when set):
41
52
  * - string: Same color for all segments
package/dist/index.js CHANGED
@@ -497,9 +497,10 @@ function createBoundariesWithFloorConfig(bounds, floorConfig) {
497
497
  for (let i = 0; i < segmentCount; i++) {
498
498
  const segmentWidth = segmentWidths[i];
499
499
  const thickness = floorConfig?.thickness !== void 0 ? Array.isArray(floorConfig.thickness) ? floorConfig.thickness[i] ?? BOUNDARY_THICKNESS : floorConfig.thickness : BOUNDARY_THICKNESS;
500
+ const visibleThickness = floorConfig?.visibleThickness !== void 0 ? Array.isArray(floorConfig.visibleThickness) ? floorConfig.visibleThickness[i] ?? thickness : floorConfig.visibleThickness : thickness;
500
501
  const color = floorConfig?.color !== void 0 ? Array.isArray(floorConfig.color) ? floorConfig.color[i] : floorConfig.color : void 0;
501
502
  const segmentX = currentX + segmentWidth / 2;
502
- const segmentY = bounds.bottom - thickness / 2;
503
+ const segmentY = bounds.bottom - visibleThickness + thickness / 2;
503
504
  const segmentOptions = {
504
505
  isStatic: true,
505
506
  label: `floor-segment-${i}`,
@@ -1514,9 +1515,21 @@ var OverlayScene = class {
1514
1515
  const { x, y } = entry.originalPosition;
1515
1516
  const width = entry.domElement.offsetWidth;
1516
1517
  const height = entry.domElement.offsetHeight;
1517
- shadowElement.style.left = `${x - width / 2}px`;
1518
- shadowElement.style.top = `${y - height / 2}px`;
1519
- shadowElement.style.transform = "rotate(0deg)";
1518
+ const computedLeft = x - width / 2;
1519
+ const computedTop = y - height / 2;
1520
+ console.log("[Shadow Debug]", {
1521
+ originalPosition: { x, y },
1522
+ elementSize: { width, height },
1523
+ computedPosition: { left: computedLeft, top: computedTop },
1524
+ elementCurrentStyle: {
1525
+ left: entry.domElement.style.left,
1526
+ top: entry.domElement.style.top,
1527
+ transform: entry.domElement.style.transform
1528
+ }
1529
+ });
1530
+ shadowElement.style.setProperty("left", `${computedLeft}px`, "important");
1531
+ shadowElement.style.setProperty("top", `${computedTop}px`, "important");
1532
+ shadowElement.style.setProperty("transform", "rotate(0deg)", "important");
1520
1533
  entry.domElement.parentNode?.insertBefore(shadowElement, entry.domElement);
1521
1534
  entry.domShadowElement = shadowElement;
1522
1535
  return;