Visualize Your Ideas With Code
feat: add middle cardinal point (#758)
Jacobb036eafc0038
diff --git a/packages/2d/src/components/Layout.ts b/packages/2d/src/components/Layout.tsindex 97d31802..33eb0113 100644--- a/packages/2d/src/components/Layout.ts+++ b/packages/2d/src/components/Layout.ts@@ -502,6 +502,22 @@ export class Layout extends Node {@vector2Signal('offset')public declare readonly offset: Vector2Signal<this>;+ /**+ * The position of the center of this node.+ *+ * @remarks+ * When set, this shortcut property will modify the node's position so that+ * the center ends up in the given place.+ *+ * If the {@link offset} has not been changed, this will be the same as the+ * {@link position}.+ *+ * When retrieved, it will return the position of the center in the parent+ * space.+ */+ @originSignal(Origin.Middle)+ public declare readonly middle: SimpleVector2Signal<this>;+/*** The position of the top edge of this node.*diff --git a/packages/docs/docs/getting-started/layouts.mdx b/packages/docs/docs/getting-started/layouts.mdxindex befc0edb..04134989 100644--- a/packages/docs/docs/getting-started/layouts.mdx+++ b/packages/docs/docs/getting-started/layouts.mdx@@ -78,7 +78,8 @@ squares on the left and right side of a gray rectangle. The yellow square ispositioned so that its right edge is in the same place as the left edge of therectangle. Meanwhile, the red square is placed so that its bottom left corneraligns with the bottom right corner of the rectangle. All possible directions-include: [`top`](/api/2d/components/Layout#top),+include: [`middle`](/api/2d/components/Layout#middle),+[`top`](/api/2d/components/Layout#top),[`bottom`](/api/2d/components/Layout#bottom),[`left`](/api/2d/components/Layout#left),[`right`](/api/2d/components/Layout#right),