How to use the @antv/x6.Perimeter.register 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 / parallelogram.ts View on Github external
}

  const center = bounds.getCenter()
  if (orthogonal) {
    if (next.x < x || next.x > x + w) {
      center.y = next.y
    } else {
      center.x = next.x
    }
  }

  return util.getPerimeterPoint(points, center, next) as Point
}

Shape.register('parallelogram', ParallelogramShape)
Perimeter.register('parallelogramPerimeter', parallelogramPerimeter)
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / trapezoid.ts View on Github external
const center = bounds.getCenter()

  if (orthogonal) {
    if (next.x < x || next.x > x + w) {
      center.y = next.y
    } else {
      center.x = next.x
    }
  }

  return util.getPerimeterPoint(points, center, next) as Point
}

Shape.register('trapezoid', TrapezoidShape)
Perimeter.register('trapezoidPerimeter', trapezoidPerimeter)
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / callout.ts View on Github external
state: State,
  next: Point,
  orthogonal: boolean,
) {
  const factor = getFactor(
    state.style,
    CalloutShape.prototype.factor,
    bounds.height,
  )
  const rect = new Rectangle(0, 0, 0, factor * state.view.scale)
  const directedBounds = util.getDirectedBounds(bounds, rect, state.style)
  return Perimeter.rectangle(directedBounds, state, next, orthogonal)
}

Shape.register('callout', CalloutShape)
Perimeter.register('calloutPerimeter', calloutPerimeter)
github antvis / x6 / examples / x6-example-drawio / src / pages / graph / shape / step.ts View on Github external
const p1 = new Point(cx, cy)

  if (orthogonal) {
    if (next.x < x || next.x > x + w) {
      p1.y = next.y
    } else {
      p1.x = next.x
    }
  }

  return util.getPerimeterPoint(points, p1, next) as Point
}

Shape.register('step', StepShape)
Perimeter.register('stepPerimeter', stepPerimeter)