Weave.js

WeaveMeasureNode

Measure node API Reference

Overview

The WeaveMeasureNode class represents visually the distance (scaled) between two points on a Weave.js canvas.

In order to render a scaled distance from pixels to real distance on the real world, it needs:

  • A measure unit, e.g. meters, centimeters, milimeters, or inches.
  • A reference measure. A distance you previously know based on the measure unit.
  • A reference distance. The distance between two points on the canvas that represent the reference

The class extends the WeaveNode class

Type

This node nodeType property value is measure.

Import

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

Instantiation

new WeaveMeasureNode(params?: WeaveMeasureNodeParams);

TypeScript types

type WeaveMeasureNodeProperties = {
  style: {
    separationLine: {
      padding: number;
      strokeWidth: number;
      dash: number[];
      stroke: string;
    };
    text: {
      padding: number;
      fontSize: number;
      fontFamily: string;
      fill: string;
    };
    intersectionCircle: {
      radius: number;
      fill: string;
    };
    measureLine: {
      stroke: string;
      dash: number[];
      strokeWidth: number;
    };
    handler: {
      noSpaceSeparationMultiplier: number;
      spaceSeparationMultiplier: number;
    };
  };
};

type WeaveMeasureNodeParams = {
  config: DeepPartial<WeaveMeasureNodeProperties>;
};

Parameters

For WeaveMeasureNodeParams:

PropTypeDefault
config
Partial<WeaveMeasureProperties>
-

For WeaveMeasureProperties:

PropTypeDefault
style.handler.spaceSeparationMultiplier?
number
1.5
style.handler.noSpaceSeparationMultiplier?
number
2.5
style.measureLine.strokeWidth?
number
1
style.measureLine.dash?
string
#FF3366
style.measureLine.stroke?
string
#FF3366
style.intersectionCircle.fill?
string
#FF3366
style.intersectionCircle.radius?
number
3
style.text.fill?
string
#FF3366
style.text.frontFamily?
string
monospace
style.text.frontSize?
number
14
style.text.padding?
number
10
style.separationLine.stroke?
string
#FF3366
style.separationLine.dash?
number[]
[]
style.separationLine.strokeWidth?
number
1
style.separationLine.padding?
number
0

Default values

const WEAVE_MEASURE_NODE_DEFAULT_CONFIG: WeaveMeasureNodeProperties = {
  style: {
    separationLine: {
      padding: 0,
      strokeWidth: 1,
      dash: [],
      stroke: "#FF3366",
    },
    text: {
      padding: 10,
      fontSize: 14,
      fontFamily: "monospace",
      fill: "#FF3366",
    },
    intersectionCircle: {
      radius: 3,
      fill: "#FF3366",
    },
    measureLine: {
      stroke: "#FF3366",
      dash: [4, 4],
      strokeWidth: 1,
    },
    handler: {
      noSpaceSeparationMultiplier: 2.5,
      spaceSeparationMultiplier: 1.5,
    },
  },
};