| 128 | |
| 129 | @nodeName('Node') |
| 130 | export class Node implements Promisable<Node> { |
| 131 | /** |
| 132 | * @internal |
| 133 | */ |
| 134 | public declare readonly [NODE_NAME]: string; |
| 135 | public declare isClass: boolean; |
| 136 | |
| 137 | /** |
| 138 | * Represents the position of this node in local space of its parent. |
| 139 | * |
| 140 | * @example |
| 141 | * Initializing the position: |
| 142 | * ```tsx |
| 143 | * // with a possible vector: |
| 144 | * <Node position={[1, 2]} /> |
| 145 | * // with individual components: |
| 146 | * <Node x={1} y={2} /> |
| 147 | * ``` |
| 148 | * |
| 149 | * Accessing the position: |
| 150 | * ```tsx |
| 151 | * // retrieving the vector: |
| 152 | * const position = node.position(); |
| 153 | * // retrieving an individual component: |
| 154 | * const x = node.position.x(); |
| 155 | * ``` |
| 156 | * |
| 157 | * Setting the position: |
| 158 | * ```tsx |
| 159 | * // with a possible vector: |
| 160 | * node.position([1, 2]); |
| 161 | * node.position(() => [1, 2]); |
| 162 | * // with individual components: |
| 163 | * node.position.x(1); |
| 164 | * node.position.x(() => 1); |
| 165 | * ``` |
| 166 | */ |
| 167 | @vector2Signal() |
| 168 | public declare readonly position: Vector2Signal<this>; |
| 169 | |
| 170 | public get x() { |
| 171 | return this.position.x as SimpleSignal<number, this>; |
| 172 | } |
| 173 | public get y() { |
| 174 | return this.position.y as SimpleSignal<number, this>; |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * A helper signal for operating on the position in world space. |
| 179 | * |
| 180 | * @remarks |
| 181 | * Retrieving the position using this signal returns the position in world |
| 182 | * space. Similarly, setting the position using this signal transforms the |
| 183 | * new value to local space. |
| 184 | * |
| 185 | * If the new value is a function, the position of this node will be |
| 186 | * continuously updated to always match the position returned by the function. |
| 187 | * This can be useful to "pin" the node in a specific place or to make it |
nothing calls this directly
no test coverage detected