@umicat/three-sdk 1.14.0 → 1.15.0

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.
@@ -39,6 +39,21 @@ export interface DualScreenTargets {
39
39
  aspect: number;
40
40
  updateProjectionMatrix(): void;
41
41
  };
42
+ /**
43
+ * For a game that sizes its own buffer (via `viewportSize`) but still wants
44
+ * its canvas put in the right place. The SDK sets the CSS BOX and nothing
45
+ * else — no `setSize`, no aspect.
46
+ *
47
+ * This exists because a game with its own camera framing cannot hand over
48
+ * the renderer, and a buffer sized to the upper panel inside a canvas still
49
+ * stretched across the window is a picture stretched to twice its height.
50
+ * Found exactly that way, on Gomoku: the rig frames the board itself and
51
+ * offsets the view for its chat column, so it asks for the viewport — and
52
+ * then had nowhere correct to draw it.
53
+ *
54
+ * Ignored when `renderer` is given, which already covers the box.
55
+ */
56
+ canvas?: HTMLCanvasElement;
42
57
  }
43
58
  /**
44
59
  * Starts keeping the page laid out for the fold. Call once, after `init`.
@@ -63,8 +63,14 @@ export function viewportSize(umicat) {
63
63
  export function installDualScreen(umicat, targets = {}) {
64
64
  let current = null;
65
65
  const applyCanvas = () => {
66
- if (!targets.renderer || !current)
66
+ if (!current)
67
67
  return;
68
+ if (!targets.renderer) {
69
+ // Box only — the game sizes its own buffer.
70
+ if (targets.canvas)
71
+ placeCanvas(current, targets.canvas);
72
+ return;
73
+ }
68
74
  const size = current.dualScreen && current.top
69
75
  ? { width: current.top.width, height: current.top.height }
70
76
  : { width: window.innerWidth, height: window.innerHeight };
@@ -82,10 +88,10 @@ export function installDualScreen(umicat, targets = {}) {
82
88
  publishVariables(layout);
83
89
  placeControls(layout);
84
90
  applyCanvas();
85
- // A game that drives its own canvas (no `renderer` here) still needs to
86
- // hear about it. Folding is a size change as far as it is concerned, but
87
- // no window resize accompanies it — the window is exactly as big as it
88
- // was, the usable part of it is not.
91
+ // A game that drives its own canvas still needs to hear about it. Folding
92
+ // is a size change as far as it is concerned, but no window resize
93
+ // accompanies it — the window is exactly as big as it was, the usable part
94
+ // of it is not.
89
95
  if (!targets.renderer)
90
96
  window.dispatchEvent(new Event('resize'));
91
97
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umicat/three-sdk",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "Three.js runtime for Umicat games: the scene3d design format, its loader with physics, a kinematic character controller, and the Umicat platform via @umicat/platform-sdk.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",