Skip to main content

Polygon Node (INodePolygon)

Polygon Node (INodePolygon)​

INodePolygon extends IShapeBase and adds one key control: polygon side count.

export interface INodePolygon extends IShapeBase {
getSideCount(): number;
setSideCount(value: number): void;
}

setSideCount is clamped to a valid polygon range by the node implementation.

Live Preview​

The preview shows three standalone polygon nodes (triangle, hexagon, octagon).
No group hierarchy is used here, each polygon is added directly to layerWorld.

Create Polygon Node in Code​

import { NodePolygon, StrokeAlign } from "@flowscape-ui/core-sdk";

const polygon = new NodePolygon(1);
polygon.setName("Hexagon");
polygon.setPosition(0, -40);
polygon.setSize(230, 230);
polygon.setSideCount(6);
polygon.setFill("#22c55e");
polygon.setStrokeFill("#dcfce7");
polygon.setStrokeWidth({ t: 8, r: 8, b: 8, l: 8 });
polygon.setStrokeAlign(StrokeAlign.Inside);

layerWorld.addNode(polygon);
scene.invalidate();

Side Count API​

MethodDescription
getSideCount()Returns current polygon side count.
setSideCount(value)Updates side count (value is clamped to valid range).

Inheritance​

INode
-> IShapeBase
-> INodePolygon

INodePolygon inherits all standard shape/base behavior: fill, stroke, transform, hierarchy, bounds, hit testing, serialization.

Next​