prerelease Prerelease 5.2.2 Latest 5.2.1
Weave.js
prerelease Prerelease 5.2.2 Latest 5.2.1

WeaveRegularPolygonNode (deprecated)

Ellipse node API Reference

Deprecated

This node is deprecated. Use the WeavePolygonNode instead.

Overview

The WeaveRegularPolygonNode class represents a basic regular polygon shape within the Weave.js canvas.

Built on top of Konva’s RegularPolygon class shape under the hood, the WeaveRegularPolygonNode offers a simple yet powerful primitive that supports full interaction, styling, and real-time synchronization.

The class extends the WeaveNode class

Type

This node nodeType property value is regular-polygon.

Import

import { WeaveRegularPolygonNode } from "@inditextech/weave-sdk";

Instantiation

new WeaveRegularPolygonNode(params?: WeaveRegularPolygonNodeParams);

TypeScript types

type WeaveNodeTransformerProperties = Konva.TransformerConfig;

type WeaveRegularPolygonProperties = {
  transform: WeaveNodeTransformerProperties;
};

type WeaveRegularPolygonNodeParams = {
  config: Partial<WeaveRegularPolygonProperties>;
};

Parameters

For WeaveRegularPolygonNodeParams:

Property Type Required Description

config

Partial<WeaveRegularPolygonProperties>

Required

Config parameters for the node.

For WeaveRegularPolygonProperties:

Property Type Required Default Description

transform

object

check default values

Setup the transform properties for the regular polygon (if can be resized, rotated, anchors, etc.).

Default values

const WEAVE_TRANSFORMER_ANCHORS = {
  ["TOP_LEFT"]: "top-left",
  ["TOP_CENTER"]: "top-center",
  ["TOP_RIGHT"]: "top-right",
  ["MIDDLE_RIGHT"]: "middle-right",
  ["MIDDLE_LEFT"]: "middle-left",
  ["BOTTOM_LEFT"]: "bottom-left",
  ["BOTTOM_CENTER"]: "bottom-center",
  ["BOTTOM_RIGHT"]: "bottom-right",
};

const WEAVE_DEFAULT_ENABLED_ANCHORS: string[] = Object.values(
  WEAVE_TRANSFORMER_ANCHORS
);

const WEAVE_DEFAULT_TRANSFORM_PROPERTIES: WeaveNodeTransformerProperties = {
  rotateEnabled: true,
  resizeEnabled: true,
  enabledAnchors: WEAVE_DEFAULT_ENABLED_ANCHORS,
  borderStrokeWidth: 3,
  padding: 0,
};