fix: start and end point is nan problem

This commit is contained in:
Yanyan-Wang 2020-03-10 10:54:10 +08:00 committed by Yanyan Wang
parent 442d01b787
commit b048eea057

View File

@ -72,15 +72,12 @@ Shape.registerEdge(
routeCfg = { source, target, offset: style.offset, radius: style.radius };
}
this.routeCfg = routeCfg;
console.log('startPoint.x === NaN', startPoint.x, isNaN(startPoint.x))
if (isNaN(startPoint.x) || isNaN(startPoint.y)) {
startPoint = {x: 0, y: 0};
let path = (this as any).getPath(points);
if (isNaN(startPoint.x) || isNaN(startPoint.y) || isNaN(endPoint.x) || isNaN(endPoint.y)) {
path = '';
}
if (isNaN(endPoint.x) || isNaN(endPoint.y)) {
endPoint = {x: 0, y: 0};
}
const path = (this as any).getPath(points);
console.log('points', points, startPoint, endPoint, path);
const attrs: ShapeStyle = mix({}, Global.defaultEdge.style as ShapeStyle, style, {
lineWidth: cfg.size,
path,