Skip to content

Commit

Permalink
fix: port angle
Browse files Browse the repository at this point in the history
  • Loading branch information
bubkoo committed Jul 16, 2020
1 parent cb349ff commit 8f117fc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/x6/src/registry/port-layout/absolute.ts
Expand Up @@ -4,13 +4,14 @@ import { normalizePoint, toResult } from './util'
export interface AbsoluteArgs {
x?: string | number
y?: string | number
angle?: number
}

export const absolute: PortLayout.Definition<AbsoluteArgs> = (
portsPositionArgs,
elemBBox,
) => {
return portsPositionArgs.map((item) =>
toResult(normalizePoint(elemBBox, item)),
return portsPositionArgs.map(({ x, y, angle }) =>
toResult(normalizePoint(elemBBox, { x, y }), angle || 0),
)
}
1 change: 1 addition & 0 deletions packages/x6/src/registry/port-layout/ellipse.ts
Expand Up @@ -58,6 +58,7 @@ function ellipseLayout(
const p = start.clone().rotate(-angle, center).scale(ratio, 1, center)

const theta = item.compensateRotate ? -ellipse.tangentTheta(p) : 0

if (item.dx || item.dy) {
p.translate(item.dx || 0, item.dy || 0)
}
Expand Down
2 changes: 2 additions & 0 deletions packages/x6/src/registry/port-layout/index.ts
Expand Up @@ -19,6 +19,8 @@ export namespace PortLayout {
}

export interface CommonArgs {
x?: number
y?: number
dx?: number
dy?: number
}
Expand Down
4 changes: 2 additions & 2 deletions packages/x6/src/registry/port-layout/line.ts
Expand Up @@ -5,8 +5,8 @@ import { PortLayout } from './index'
export interface SideArgs extends PortLayout.CommonArgs {}

export interface LineArgs extends SideArgs {
start?: Point | Point.PointLike
end?: Point | Point.PointLike
start?: Point.PointLike
end?: Point.PointLike
}

export const line: PortLayout.Definition<LineArgs> = (
Expand Down

0 comments on commit 8f117fc

Please sign in to comment.