Resizes the node area. The width. The height.
(float width, float height)
| 182 | /// <param name="width">The width.</param> |
| 183 | /// <param name="height">The height.</param> |
| 184 | public virtual void Resize(float width, float height) |
| 185 | { |
| 186 | if (Surface == null) |
| 187 | return; |
| 188 | |
| 189 | // Snap bounds (with ceil) when using grid snapping |
| 190 | if (Surface.GridSnappingEnabled) |
| 191 | { |
| 192 | var size = Surface.SnapToGrid(new Float2(width, height), true); |
| 193 | width = size.X; |
| 194 | height = size.Y; |
| 195 | } |
| 196 | |
| 197 | // Arrange output boxes on the right edge |
| 198 | for (int i = 0; i < Elements.Count; i++) |
| 199 | { |
| 200 | if (Elements[i] is OutputBox box) |
| 201 | { |
| 202 | box.Location = box.Archetype.Position + new Float2(width - Constants.NodeMarginX, 0); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | // Resize |
| 207 | Size = CalculateNodeSize(width, height); |
| 208 | } |
| 209 | |
| 210 | /// <summary> |
| 211 | /// Automatically resizes the node to match the title size and all the elements for best fit of the node dimensions. |
no test coverage detected