castle-web-cli 0.4.192 → 0.4.194

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.
Files changed (78) hide show
  1. package/dist/agent.js +87 -4
  2. package/dist/api.d.ts +14 -0
  3. package/dist/api.js +13 -1
  4. package/dist/bundle.js +2 -1
  5. package/dist/castleJson.d.ts +1 -0
  6. package/dist/check.js +14 -6
  7. package/dist/devSessionServer.d.ts +6 -0
  8. package/dist/devSessionServer.js +23 -1
  9. package/dist/filesChanged.js +7 -3
  10. package/dist/importUpdateHook.d.ts +31 -0
  11. package/dist/importUpdateHook.js +135 -0
  12. package/dist/importUpdateHookRunner.d.ts +2 -0
  13. package/dist/importUpdateHookRunner.js +24 -0
  14. package/dist/imports.js +56 -6
  15. package/dist/index.js +58 -7
  16. package/dist/init.d.ts +1 -0
  17. package/dist/init.js +6 -1
  18. package/dist/native/loop.js +29 -9
  19. package/dist/native/playtest-remote.js +53 -5
  20. package/dist/native/playtest.d.ts +11 -0
  21. package/dist/native/playtest.js +91 -5
  22. package/dist/platformDoc.js +4 -4
  23. package/dist/remix.js +4 -1
  24. package/dist/serve.js +133 -32
  25. package/dist/serverBundle.js +1 -1
  26. package/dist/versions.d.ts +14 -0
  27. package/dist/versions.js +21 -0
  28. package/dist/vitePlugins.d.ts +1 -0
  29. package/dist/vitePlugins.js +18 -0
  30. package/kits/multiplayer-2d/CLAUDE.md +9 -2
  31. package/kits/multiplayer-2d/blueprints/crate.scene +32 -4
  32. package/kits/multiplayer-2d/blueprints/other-player.scene +31 -4
  33. package/kits/multiplayer-2d/blueprints/player.scene +38 -6
  34. package/kits/multiplayer-2d/blueprints/wall.scene +25 -3
  35. package/kits/multiplayer-2d/castle.json +3 -3
  36. package/kits/multiplayer-2d/test/two-client-test.mjs +4 -4
  37. package/kits/multiplayer-3d/CLAUDE.md +5 -2
  38. package/kits/multiplayer-3d/castle.json +3 -3
  39. package/kits/multiplayer-3d/scenes/main.scene +128 -0
  40. package/kits/physics-2d/CLAUDE.md +11 -5
  41. package/kits/physics-2d/behaviors/Camera.jsx +5 -6
  42. package/kits/physics-2d/behaviors/Goal.jsx +5 -2
  43. package/kits/physics-2d/behaviors/Joints.jsx +4 -3
  44. package/kits/physics-2d/behaviors/Layout.jsx +120 -3
  45. package/kits/physics-2d/behaviors/Sprite.jsx +9 -9
  46. package/kits/physics-2d/behaviors/Style.jsx +22 -15
  47. package/kits/physics-2d/behaviors/Text.jsx +7 -6
  48. package/kits/physics-2d/blueprints/ball.scene +27 -5
  49. package/kits/physics-2d/blueprints/block.scene +16 -3
  50. package/kits/physics-2d/blueprints/cauldron.scene +3 -1
  51. package/kits/physics-2d/blueprints/crate.scene +23 -4
  52. package/kits/physics-2d/blueprints/goal.scene +12 -2
  53. package/kits/physics-2d/blueprints/text.scene +13 -3
  54. package/kits/physics-2d/castle.json +2 -1
  55. package/kits/physics-2d/editors/SceneEditor.jsx +26 -2
  56. package/kits/physics-2d/editors/SelectionOverlay.jsx +27 -20
  57. package/kits/physics-2d/engine/blueprint.js +111 -54
  58. package/kits/physics-2d/engine/blueprintCore.js +59 -0
  59. package/kits/physics-2d/engine/collider.js +28 -17
  60. package/kits/physics-2d/engine/layout.js +61 -0
  61. package/kits/physics-2d/engine/layoutOriginMigration.js +223 -0
  62. package/kits/physics-2d/engine/physics/PhysicsSystem.js +11 -7
  63. package/kits/physics-2d/engine/physics/controls.js +4 -8
  64. package/kits/physics-2d/engine/physics/matterBridge.js +13 -8
  65. package/kits/physics-2d/engine/scene.js +38 -34
  66. package/kits/physics-2d/engine/spriteGeometry.js +17 -9
  67. package/kits/physics-2d/engine/tap.js +4 -3
  68. package/kits/physics-2d/scenes/main.scene +59 -6
  69. package/kits/physics-2d/scenes/sandbox.scene +69 -7
  70. package/kits/physics-2d/scripts/onUpdate.mjs +199 -0
  71. package/kits/real-time/castle.json +2 -2
  72. package/kits/real-time/code/server/persist.js +14 -0
  73. package/kits/turn-based/CLAUDE.md +12 -7
  74. package/kits/turn-based/blueprints/board.scene +3 -1
  75. package/kits/turn-based/blueprints/square.scene +3 -1
  76. package/kits/turn-based/castle.json +5 -3
  77. package/kits/turn-based/code/behaviors/Board.jsx +33 -21
  78. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { layoutRect } from '../engine/layout';
2
3
  import { PaletteColorField } from '../engine/paletteField';
3
4
  import { NumberField, Panel } from '../engine/ui';
4
5
  import { AutoFields, overrideProps } from '../engine/autoInspector';
@@ -153,12 +154,12 @@ function contentPaintsStyle(actor) {
153
154
  }
154
155
 
155
156
  function paintStyleChrome(actor, ctx, props) {
156
- const layout = actor.components.Layout;
157
- if (!layout || !props) return;
157
+ const box = layoutRect(actor.components.Layout);
158
+ if (!box || !props) return;
158
159
  const { background, border, borderWidth, borderRadius, opacity } = props;
159
160
  const alpha = Number.isFinite(opacity) ? Math.min(1, Math.max(0, opacity)) : 1;
160
161
  const bw = Math.max(0, Number(borderWidth) || 0);
161
- const radius = clampRadius(borderRadius, layout.width, layout.height);
162
+ const radius = clampRadius(borderRadius, box.width, box.height);
162
163
  const shadow = resolveShadow(props);
163
164
  const hasFill = Boolean(background);
164
165
  const hasBorder = Boolean(border) && bw > 0;
@@ -174,12 +175,12 @@ function paintStyleChrome(actor, ctx, props) {
174
175
  }
175
176
  if (hasFill) {
176
177
  ctx.fillStyle = background;
177
- fillRoundRect(ctx, layout.x, layout.y, layout.width, layout.height, radius);
178
+ fillRoundRect(ctx, box.x, box.y, box.width, box.height, radius);
178
179
  } else if (shadow) {
179
180
  // Shadow needs a filled path; use a near-invisible fill when there's no
180
181
  // background so the drop shadow still casts.
181
182
  ctx.fillStyle = 'rgba(0, 0, 0, 0.01)';
182
- fillRoundRect(ctx, layout.x, layout.y, layout.width, layout.height, radius);
183
+ fillRoundRect(ctx, box.x, box.y, box.width, box.height, radius);
183
184
  }
184
185
  if (shadow) {
185
186
  ctx.shadowColor = 'transparent';
@@ -195,10 +196,10 @@ function paintStyleChrome(actor, ctx, props) {
195
196
  // the same amount so the outer curve still matches the fill's corner.
196
197
  strokeRoundRect(
197
198
  ctx,
198
- layout.x + inset,
199
- layout.y + inset,
200
- Math.max(0, layout.width - bw),
201
- Math.max(0, layout.height - bw),
199
+ box.x + inset,
200
+ box.y + inset,
201
+ Math.max(0, box.width - bw),
202
+ Math.max(0, box.height - bw),
202
203
  Math.max(0, radius - inset)
203
204
  );
204
205
  }
@@ -251,15 +252,21 @@ export function stylePadding(actor) {
251
252
  return Number.isFinite(pad) ? Math.max(0, pad) : 0;
252
253
  }
253
254
 
254
- /** Layout box inset by Style.padding, or the layout itself when padding is 0. */
255
+ /**
256
+ * The world-space rect content draws into: the actor's Layout box (origin
257
+ * applied) inset by Style.padding. Always a real rect, never the `layout`
258
+ * component itself -- callers read `.x`/`.y` as a top-left, which a Layout with
259
+ * a non-zero origin is not.
260
+ */
255
261
  export function styleContentBox(actor, layout) {
262
+ const box = layoutRect(layout);
256
263
  const pad = stylePadding(actor);
257
- if (!(pad > 0) || !layout) return layout;
264
+ if (!box || !(pad > 0)) return box;
258
265
  return {
259
- x: layout.x + pad,
260
- y: layout.y + pad,
261
- width: Math.max(0, layout.width - pad * 2),
262
- height: Math.max(0, layout.height - pad * 2),
266
+ x: box.x + pad,
267
+ y: box.y + pad,
268
+ width: Math.max(0, box.width - pad * 2),
269
+ height: Math.max(0, box.height - pad * 2),
263
270
  };
264
271
  }
265
272
 
@@ -1,5 +1,6 @@
1
1
  import { writeFile } from 'castle-web-sdk';
2
2
  import React from 'react';
3
+ import { layoutRect } from '../engine/layout';
3
4
  import { drawTextBlock } from '../engine/text';
4
5
  import { PaletteColorField } from '../engine/paletteField';
5
6
  import {
@@ -56,8 +57,8 @@ export class Text {
56
57
  }
57
58
 
58
59
  paint(actor, scene, ctx) {
59
- const layout = actor.components.Layout;
60
- if (!layout) return;
60
+ const box = layoutRect(actor.components.Layout);
61
+ if (!box) return;
61
62
  const {
62
63
  text,
63
64
  font,
@@ -73,10 +74,10 @@ export class Text {
73
74
  ctx.save();
74
75
  ctx.globalAlpha *= styleOpacity(actor);
75
76
  drawTextBlock(ctx, {
76
- x: layout.x,
77
- y: layout.y,
78
- width: layout.width,
79
- height: layout.height,
77
+ x: box.x,
78
+ y: box.y,
79
+ width: box.width,
80
+ height: box.height,
80
81
  text,
81
82
  size,
82
83
  font: resolveTextFont(font),
@@ -3,11 +3,33 @@
3
3
  "actors": [
4
4
  {
5
5
  "components": {
6
- "Layout": { "width": 44, "height": 44, "z": 2 },
7
- "Sprite": { "file": "drawings/cauldron.sprite", "mode": "fit" },
8
- "Collider": { "shape": "circle", "width": 40, "height": 40, "bounciness": 0.6, "friction": 0.05 },
9
- "RigidBody": { "bodyType": "dynamic", "gravityScale": 1, "drag": 0.005 },
10
- "Slingshot": { "speed": 0.1, "maxDrag": 200 }
6
+ "Layout": {
7
+ "width": 44,
8
+ "height": 44,
9
+ "z": 2,
10
+ "originX": 0.5,
11
+ "originY": 0.5
12
+ },
13
+ "Sprite": {
14
+ "file": "drawings/cauldron.sprite",
15
+ "mode": "fit"
16
+ },
17
+ "Collider": {
18
+ "shape": "circle",
19
+ "width": 40,
20
+ "height": 40,
21
+ "bounciness": 0.6,
22
+ "friction": 0.05
23
+ },
24
+ "RigidBody": {
25
+ "bodyType": "dynamic",
26
+ "gravityScale": 1,
27
+ "drag": 0.005
28
+ },
29
+ "Slingshot": {
30
+ "speed": 0.1,
31
+ "maxDrag": 200
32
+ }
11
33
  }
12
34
  }
13
35
  ]
@@ -3,9 +3,22 @@
3
3
  "actors": [
4
4
  {
5
5
  "components": {
6
- "Layout": { "width": 100, "height": 40, "z": 1 },
7
- "Sprite": { "file": "drawings/block.sprite", "mode": "tile", "tileSize": 20 },
8
- "Collider": { "bounciness": 0.4, "friction": 0.2 }
6
+ "Layout": {
7
+ "width": 100,
8
+ "height": 40,
9
+ "z": 1,
10
+ "originX": 0.5,
11
+ "originY": 0.5
12
+ },
13
+ "Sprite": {
14
+ "file": "drawings/block.sprite",
15
+ "mode": "tile",
16
+ "tileSize": 20
17
+ },
18
+ "Collider": {
19
+ "bounciness": 0.4,
20
+ "friction": 0.2
21
+ }
9
22
  }
10
23
  }
11
24
  ]
@@ -6,7 +6,9 @@
6
6
  "Layout": {
7
7
  "width": 100,
8
8
  "height": 100,
9
- "z": 1
9
+ "z": 1,
10
+ "originX": 0.5,
11
+ "originY": 0.5
10
12
  },
11
13
  "Sprite": {
12
14
  "file": "drawings/cauldron.sprite"
@@ -3,10 +3,29 @@
3
3
  "actors": [
4
4
  {
5
5
  "components": {
6
- "Layout": { "width": 48, "height": 48, "z": 2 },
7
- "Sprite": { "file": "drawings/block.sprite", "mode": "fit" },
8
- "Collider": { "shape": "box", "width": 46, "height": 46, "bounciness": 0.2, "friction": 0.3 },
9
- "RigidBody": { "bodyType": "dynamic", "gravityScale": 1, "drag": 0.02 },
6
+ "Layout": {
7
+ "width": 48,
8
+ "height": 48,
9
+ "z": 2,
10
+ "originX": 0.5,
11
+ "originY": 0.5
12
+ },
13
+ "Sprite": {
14
+ "file": "drawings/block.sprite",
15
+ "mode": "fit"
16
+ },
17
+ "Collider": {
18
+ "shape": "box",
19
+ "width": 46,
20
+ "height": 46,
21
+ "bounciness": 0.2,
22
+ "friction": 0.3
23
+ },
24
+ "RigidBody": {
25
+ "bodyType": "dynamic",
26
+ "gravityScale": 1,
27
+ "drag": 0.02
28
+ },
10
29
  "Draggable": {}
11
30
  }
12
31
  }
@@ -3,8 +3,18 @@
3
3
  "actors": [
4
4
  {
5
5
  "components": {
6
- "Layout": { "width": 110, "height": 34, "z": 3 },
7
- "Collider": { "width": 110, "height": 34, "isTrigger": true },
6
+ "Layout": {
7
+ "width": 110,
8
+ "height": 34,
9
+ "z": 3,
10
+ "originX": 0.5,
11
+ "originY": 0.5
12
+ },
13
+ "Collider": {
14
+ "width": 110,
15
+ "height": 34,
16
+ "isTrigger": true
17
+ },
8
18
  "Goal": {}
9
19
  }
10
20
  }
@@ -3,9 +3,19 @@
3
3
  "actors": [
4
4
  {
5
5
  "components": {
6
- "Layout": { "width": 280, "height": 50, "z": 5 },
7
- "Style": { "padding": 8 },
8
- "Text": { "text": "Your text goes here" }
6
+ "Layout": {
7
+ "width": 280,
8
+ "height": 50,
9
+ "z": 5,
10
+ "originX": 0.5,
11
+ "originY": 0.5
12
+ },
13
+ "Style": {
14
+ "padding": 8
15
+ },
16
+ "Text": {
17
+ "text": "Your text goes here"
18
+ }
9
19
  }
10
20
  }
11
21
  ]
@@ -75,8 +75,9 @@
75
75
  "cardId": "_oBFbAW6DxsO",
76
76
  "main": "main.jsx",
77
77
  "autoUpdateWhenImported": true,
78
+ "onUpdate": "scripts/onUpdate.mjs",
78
79
  "title": "physics-2d",
79
- "publishedVersion": "2026-09-13T17:33:26.446Z",
80
+ "publishedVersion": "2026-09-16T21:17:53.144Z",
80
81
  "imports": {
81
82
  "castle.base": {
82
83
  "deckId": "yRcmH4_aYllE",
@@ -45,6 +45,7 @@ import {
45
45
  placeBlueprintInstance,
46
46
  renameBlueprintCascade,
47
47
  setBlueprintName,
48
+ setBlueprintOriginCascade,
48
49
  setBlueprintTemplateComponents,
49
50
  setInstanceComponent,
50
51
  } from '../engine/blueprint';
@@ -453,11 +454,34 @@ export function SceneEditor({
453
454
  if (onChangeFile) onChangeFile(selectedBlueprintPath, nextText);
454
455
  else void writeFile(selectedBlueprintPath, nextText);
455
456
  };
457
+ // The Layout origin is the one template prop whose edit MOVES existing
458
+ // instances: it changes what their own stored x/y means. So it goes through
459
+ // the cascade, which re-anchors every instance in every scene of this deck in
460
+ // the same gesture, and the writes land the way `renameCommit`'s do -- the
461
+ // open scene through history (so undo covers it), the rest as file writes.
462
+ const commitBlueprintOrigin = (nextProps) => {
463
+ if (blueprintLocked || !selectedBlueprintPath || !hotbarBlueprint) return;
464
+ const result = setBlueprintOriginCascade(files, selectedBlueprintPath, nextProps);
465
+ if (!result) return;
466
+ // Instances here move too. If this scene can't be written, refuse rather
467
+ // than shift the other scenes' instances and leave these behind.
468
+ if (readOnly && result.writes.some((write) => write.path === path)) return;
469
+ for (const write of result.writes) {
470
+ if (write.path === path) history.commit(write.text);
471
+ else if (onChangeFile) onChangeFile(write.path, write.text);
472
+ else void writeFile(write.path, write.text);
473
+ }
474
+ };
456
475
  const blueprintActions = {
457
- setComponent: (behaviorName, nextProps) =>
476
+ setComponent: (behaviorName, nextProps) => {
477
+ if (behaviorName === 'Layout' && ('originX' in nextProps || 'originY' in nextProps)) {
478
+ commitBlueprintOrigin(nextProps);
479
+ return;
480
+ }
458
481
  updateBlueprintTemplate((components) => {
459
482
  components[behaviorName] = { ...(components[behaviorName] ?? {}), ...nextProps };
460
- }),
483
+ });
484
+ },
461
485
  // Brings expected siblings along, as the actor path does -- a lone Draggable
462
486
  // is silently inert without a Collider.
463
487
  addBehavior: (behaviorName) => {
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { getColliderShapes } from '../behaviors/Collider';
3
+ import { layoutCenter, layoutOriginX, layoutOriginY, layoutXYForRect } from '../engine/layout';
3
4
  import { cardSize, screenToCard, isBehaviorEnabled } from '../engine/scene';
4
5
  import { cx, Icon, styles, useElementSize } from '../engine/ui';
5
6
 
@@ -497,6 +498,7 @@ function getSelectedColliderFrames(sceneData, actorIds, sprites) {
497
498
  // needs no such check -- it runs through `forEachBehavior`, which is
498
499
  // gated -- but this overlay reads the component directly.
499
500
  if (!layout || !isBehaviorEnabled(collider) || !shapes) return [];
501
+ const center = layoutCenter(layout);
500
502
  const isTrigger = Boolean(collider.isTrigger) || collider.kind === 'pickup';
501
503
  // One preview box per collider shape, from the shared geometry so the
502
504
  // preview matches the physics body. A circle renders as a radius-sized
@@ -545,8 +547,10 @@ function getSelectedColliderFrames(sceneData, actorIds, sprites) {
545
547
  height,
546
548
  rotation: layout.rotation ?? 0,
547
549
  shapeAngle: s.type === 'box' ? s.angle ?? 0 : 0,
548
- originX: layout.x + layout.width / 2 - x,
549
- originY: layout.y + layout.height / 2 - y,
550
+ // CSS transform-origin for the actor's rotation, relative to this
551
+ // shape's own top-left: the Layout box center, as ever.
552
+ originX: center.x - x,
553
+ originY: center.y - y,
550
554
  };
551
555
  });
552
556
  });
@@ -584,10 +588,7 @@ function getOrientedLayoutBounds(layouts, rotation) {
584
588
  }
585
589
 
586
590
  function getLayoutWorldCorners(layout) {
587
- const center = {
588
- x: layout.x + layout.width / 2,
589
- y: layout.y + layout.height / 2,
590
- };
591
+ const center = layoutCenter(layout);
591
592
  const halfW = layout.width / 2;
592
593
  const halfH = layout.height / 2;
593
594
  const rotation = layout.rotation ?? 0;
@@ -705,12 +706,17 @@ function collectLayoutStarts(sceneData, actorIds) {
705
706
  if (!wanted.has(actor.id)) continue;
706
707
  const layout = actor.components.Layout;
707
708
  if (layout) {
709
+ // Layout-shaped on purpose: the origin travels with the snapshot, so
710
+ // `layoutCenter(start)` / `layoutXYForRect(rect, start)` read and write it
711
+ // exactly as they do a live Layout.
708
712
  starts[actor.id] = {
709
713
  x: layout.x,
710
714
  y: layout.y,
711
715
  width: layout.width,
712
716
  height: layout.height,
713
717
  rotation: layout.rotation ?? 0,
718
+ originX: layoutOriginX(layout),
719
+ originY: layoutOriginY(layout),
714
720
  };
715
721
  }
716
722
  }
@@ -759,17 +765,23 @@ function moveSelected(sceneData, previewSceneData, actorIds, starts, dx, dy) {
759
765
  });
760
766
  }
761
767
 
768
+ // The rounded Layout `x`/`y` that leaves a `width`x`height` box centered on
769
+ // `center`, under the origin `start` carries. Every gesture below computes where
770
+ // the BOX should end up (as it always did) and comes back through here.
771
+ function roundedXYForBox(center, width, height, start) {
772
+ const xy = layoutXYForRect(
773
+ { x: center.x - width / 2, y: center.y - height / 2, width, height },
774
+ start
775
+ );
776
+ return { x: Math.round(xy.x), y: Math.round(xy.y) };
777
+ }
778
+
762
779
  // Common-pivot rotation: actor centers orbit the selection pivot while each
763
780
  // actor also spins by the same delta, matching a temporary group transform.
764
781
  function rotateSelected(sceneData, previewSceneData, actorIds, starts, pivot, deltaDeg) {
765
782
  return updateSelectedLayouts(sceneData, previewSceneData, actorIds, starts, (layout, start) => {
766
- const center = {
767
- x: start.x + start.width / 2,
768
- y: start.y + start.height / 2,
769
- };
770
- const nextCenter = rotatePoint(center, pivot, deltaDeg);
771
- const x = Math.round(nextCenter.x - start.width / 2);
772
- const y = Math.round(nextCenter.y - start.height / 2);
783
+ const nextCenter = rotatePoint(layoutCenter(start), pivot, deltaDeg);
784
+ const { x, y } = roundedXYForBox(nextCenter, start.width, start.height, start);
773
785
  const rotation = normalizeAngle((start.rotation ?? 0) + deltaDeg);
774
786
  if (layout.x === x && layout.y === y && (layout.rotation ?? 0) === rotation) return null;
775
787
  return { x, y, rotation };
@@ -781,11 +793,7 @@ function scaleSelected(sceneData, previewSceneData, actorIds, starts, startTrans
781
793
  const scaleX = startBounds.width === 0 ? 1 : nextLocalBounds.width / startBounds.width;
782
794
  const scaleY = startBounds.height === 0 ? 1 : nextLocalBounds.height / startBounds.height;
783
795
  return updateSelectedLayouts(sceneData, previewSceneData, actorIds, starts, (layout, start) => {
784
- const startCenter = {
785
- x: start.x + start.width / 2,
786
- y: start.y + start.height / 2,
787
- };
788
- const localCenter = worldToLocal(startCenter, startTransform);
796
+ const localCenter = worldToLocal(layoutCenter(start), startTransform);
789
797
  const nextLocalCenter = {
790
798
  x: nextLocalBounds.left + (localCenter.x - startBounds.left) * scaleX,
791
799
  y: nextLocalBounds.top + (localCenter.y - startBounds.top) * scaleY,
@@ -793,8 +801,7 @@ function scaleSelected(sceneData, previewSceneData, actorIds, starts, startTrans
793
801
  const nextCenter = localToWorld(nextLocalCenter, startTransform);
794
802
  const width = Math.max(MIN_LAYOUT_SIZE, Math.round(start.width * scaleX));
795
803
  const height = Math.max(MIN_LAYOUT_SIZE, Math.round(start.height * scaleY));
796
- const x = Math.round(nextCenter.x - width / 2);
797
- const y = Math.round(nextCenter.y - height / 2);
804
+ const { x, y } = roundedXYForBox(nextCenter, width, height, start);
798
805
  if (layout.x === x && layout.y === y && layout.width === width && layout.height === height) {
799
806
  return null;
800
807
  }