How to use the @antv/x6.util.getNumber function in @antv/x6

To help you get started, we’ve selected a few @antv/x6 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / flex-arrow.ts View on Github external
getEdgeWidth() {
    return (
      util.getNumber(this.style, 'width', this.defaultWidth) +
      Math.max(0, this.strokeWidth - 1)
    )
  }
}
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / cube.ts View on Github external
getLabelMargins(rect: Rectangle) {
    if (util.getBoolean(this.style, 'boundedLbl', false)) {
      const s = util.getNumber(this.style, 'factor', this.factor) * this.scale
      return new Rectangle(s, s, 0, 0)
    }

    return null
  }
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / note.ts View on Github external
drawNodeShape(c: SvgCanvas2D, x: number, y: number, w: number, h: number) {
    const factor = util.getNumber(this.style, 'factor', this.factor)
    const darkOpacity = util.getNumber(
      this.style,
      'darkOpacity',
      this.darkOpacity,
    )
    const s = Math.max(0, Math.min(w, Math.min(h, factor)))
    const op = Math.max(-1, Math.min(1, darkOpacity))
    c.translate(x, y)

    c.begin()
    c.moveTo(0, 0)
    c.lineTo(w - s, 0)
    c.lineTo(w, s)
    c.lineTo(w, h)
    c.lineTo(0, h)
    c.lineTo(0, 0)
    c.close()
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / card.ts View on Github external
redrawPath(c: SvgCanvas2D, x: number, y: number, w: number, h: number) {
    const arcSize = this.getLineArcSize()
    const factor = util.getNumber(this.style, 'factor', this.factor)
    const s = Math.max(0, Math.min(w, Math.min(h, factor)))

    this.drawPoints(
      c,
      [
        new Point(s, 0),
        new Point(w, 0),
        new Point(w, h),
        new Point(0, h),
        new Point(0, s),
      ],
      this.rounded,
      arcSize,
      true,
    )
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / callout.ts View on Github external
getLabelMargins() {
    return new Rectangle(
      0,
      0,
      0,
      util.getNumber(this.style, 'factor', this.factor) * this.scale,
    )
  }
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / link.ts View on Github external
getEdgeWidth() {
    return (
      util.getNumber(this.style, 'width', this.defaultWidth) +
      Math.max(0, this.strokeWidth - 1)
    )
  }
}
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / cube.ts View on Github external
drawNodeShape(c: SvgCanvas2D, x: number, y: number, w: number, h: number) {
    const factor = util.getNumber(this.style, 'factor', this.factor)
    const darkOpacity = util.getNumber(
      this.style,
      'darkOpacity',
      this.darkOpacity,
    )
    const darkOpacity2 = util.getNumber(
      this.style,
      'darkOpacity2',
      this.darkOpacity2,
    )
    const s = Math.max(0, Math.min(w, Math.min(h, factor)))
    const op = Math.max(-1, Math.min(1, darkOpacity))
    const op2 = Math.max(-1, Math.min(1, darkOpacity2))
    c.translate(x, y)

    c.begin()
    c.moveTo(0, 0)
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / flex-arrow.ts View on Github external
getEndArrowWidth() {
    return (
      this.getEdgeWidth() +
      util.getNumber(this.style, 'endWidth', this.defaultArrowWidth)
    )
  }