mirror of
https://gitee.com/antv/g6.git
synced 2024-12-03 04:08:32 +08:00
test: find start and end point
This commit is contained in:
parent
b048eea057
commit
8f21d9e650
@ -52,11 +52,13 @@ export default class Edge extends Item implements IEdge {
|
||||
const pointName = END_MAP[name] + POINT_NAME_SUFFIX;
|
||||
const itemName = name + ITEM_NAME_SUFFIX;
|
||||
let point = this.get(pointName);
|
||||
console.log('get link point', point);
|
||||
if (!point) {
|
||||
const item = this.get(itemName);
|
||||
const anchorName = name + ANCHOR_NAME_SUFFIX;
|
||||
const prePoint = this.getPrePoint(name, controlPoints);
|
||||
const anchorIndex = model[anchorName];
|
||||
console.log('!isNil(anchorIndex)', !isNil(anchorIndex));
|
||||
if (!isNil(anchorIndex)) {
|
||||
// 如果有锚点,则使用锚点索引获取连接点
|
||||
point = item.getLinkPointByAnchor(anchorIndex);
|
||||
@ -67,6 +69,7 @@ export default class Edge extends Item implements IEdge {
|
||||
this.set(`${name}AnchorIndex`, point.index);
|
||||
}
|
||||
}
|
||||
console.log('get link point final', point, model);
|
||||
return point;
|
||||
}
|
||||
|
||||
@ -151,6 +154,7 @@ export default class Edge extends Item implements IEdge {
|
||||
}
|
||||
cfg.sourceNode = self.get('sourceNode');
|
||||
cfg.targetNode = self.get('targetNode');
|
||||
console.log('returning cfg', cfg);
|
||||
return cfg;
|
||||
}
|
||||
|
||||
|
@ -83,6 +83,7 @@ export default class Node extends Item implements INode {
|
||||
const { centerX, centerY } = bbox;
|
||||
const anchorPoints = this.getAnchorPoints();
|
||||
let intersectPoint: IPoint | null;
|
||||
console.log('getLinkPoint', point, type, centerX, centerY, bbox.width);
|
||||
switch (type) {
|
||||
case 'circle':
|
||||
intersectPoint = getCircleIntersectByPoint(
|
||||
@ -108,6 +109,7 @@ export default class Node extends Item implements INode {
|
||||
default:
|
||||
intersectPoint = getRectIntersectByPoint(bbox, point);
|
||||
}
|
||||
console.log('intersectPoint', intersectPoint);
|
||||
let linkPoint = intersectPoint;
|
||||
// 如果存在锚点,则使用交点计算最近的锚点
|
||||
if (anchorPoints.length) {
|
||||
|
@ -338,7 +338,7 @@ describe('dagre layout', () => {
|
||||
},
|
||||
renderer: 'svg',
|
||||
defaultEdge: {
|
||||
type: 'polyline',
|
||||
type: 'line',
|
||||
style: {
|
||||
radius: 20,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user