Skip to content

矩形元素

Rectangle

It is used to render rectangle content. The specific type is as follows:

ts
type Rect = {
  type: 'rect';
  x: number;
  y: number;
  w: number;
  h: number;
  angle: number;
  detail: {
    background: string;
    borderRadius?: string;
    borderWidth?: number;
    borderColor?: number;
  };
};

Rect.detail

The basic attribute details of the element can be viewed Element's Detail # .

Rect.detail Data-Type

The Data-Type of Rect.detail

ts
type RectDetail = {
  background?: string;
  background?: string;
  borderWidth?: number;
  borderColor?: string;
};

Rect.detail Properties

PropertyDescriptionTypeDefaultRequiredOthers
colorRectangle colorstring-trueeg. #000000
backgroundRectangle background colorstring-trueeg. #000000
borderRadiusRectangle radius of border cornernumber0false-
borderWidthBorder width of Rectanglenumber0false-
borderColorBorder color of Rectanglestring-falseeg. #000000

Complete Data Example

js
const elementRect = {
  name: 'rect',
  x: 160,
  y: 120,
  w: 200,
  h: 100,
  angle: 30,
  type: 'rect',
  detail: {
    background: '#d5f5f9',
    borderRadius: 10,
    borderWidth: 2,
    borderColor: '#3f51b5'
  }
};

Demo Preview

More Demo >>