refactor(edge-utils): check center params for undefined
This commit is contained in:
@@ -29,8 +29,8 @@ export function getBezierPath({
|
|||||||
const [_centerX, _centerY] = getCenter({ sourceX, sourceY, targetX, targetY });
|
const [_centerX, _centerY] = getCenter({ sourceX, sourceY, targetX, targetY });
|
||||||
const leftAndRight = [Position.Left, Position.Right];
|
const leftAndRight = [Position.Left, Position.Right];
|
||||||
|
|
||||||
const cX = centerX ? centerX : _centerX;
|
const cX = typeof centerX !== 'undefined' ? centerX : _centerX;
|
||||||
const cY = centerY ? centerY : _centerY;
|
const cY = typeof centerY !== 'undefined' ? centerY : _centerY;
|
||||||
|
|
||||||
let path = `M${sourceX},${sourceY} C${sourceX},${cY} ${targetX},${cY} ${targetX},${targetY}`;
|
let path = `M${sourceX},${sourceY} C${sourceX},${cY} ${targetX},${cY} ${targetX},${targetY}`;
|
||||||
|
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ export function getSmoothStepPath({
|
|||||||
let firstCornerPath = null;
|
let firstCornerPath = null;
|
||||||
let secondCornerPath = null;
|
let secondCornerPath = null;
|
||||||
|
|
||||||
const cX = centerX ? centerX : _centerX;
|
const cX = typeof centerX !== 'undefined' ? centerX : _centerX;
|
||||||
const cY = centerY ? centerY : _centerY;
|
const cY = typeof centerY !== 'undefined' ? centerY : _centerY;
|
||||||
|
|
||||||
// default case: source and target positions are top or bottom
|
// default case: source and target positions are top or bottom
|
||||||
if (sourceX <= targetX) {
|
if (sourceX <= targetX) {
|
||||||
|
|||||||
Reference in New Issue
Block a user