layout增加倒三角符号

This commit is contained in:
zhenggengtong 2022-03-19 17:53:51 +08:00
parent dbb3b3efde
commit 88ec08ec20
7 changed files with 11932 additions and 2663 deletions

View File

@ -64,9 +64,10 @@ SV.registerLayout('ChainHashTable', {
} }
} }
}, },
pointer: { marker: {
external: { external: {
anchor: 3, type: 'pointer',
anchor: 1,
offset: 8, offset: 8,
style: { style: {
fill: '#f08a5d' fill: '#f08a5d'

View File

@ -72,6 +72,20 @@ SV.registerLayout('LinkQueue', {
fill: '#333' fill: '#333'
} }
} }
},
loopNext: {
type: 'quadratic',
curveOffset: -100,
sourceAnchor: 2,
targetAnchor: 7,
style: {
stroke: '#333',
endArrow: 'default',
startArrow: {
path: G6.Arrow.circle(2, -1),
fill: '#333'
}
}
} }
}, },
marker: { marker: {
@ -85,7 +99,7 @@ SV.registerLayout('LinkQueue', {
}, },
layout: { layout: {
xInterval: 50, xInterval: 50,
yInterval: 50 yInterval: 58
}, },
behavior: { behavior: {
dragNode: ['node'] dragNode: ['node']

View File

@ -44,6 +44,20 @@
fill: '#333' fill: '#333'
} }
} }
},
loopNext: {
type: 'quadratic',
curveOffset: -100,
sourceAnchor: 2,
targetAnchor: 7,
style: {
stroke: '#333',
endArrow: 'default',
startArrow: {
path: G6.Arrow.circle(2, -1),
fill: '#333'
}
}
} }
}, },
marker: { marker: {

View File

@ -35,8 +35,12 @@ SV.registerLayout('PTree', {
data: sources[i].parent data: sources[i].parent
}); });
} }
sources[0].indexLeft = 'data'; if(sources[0]){
parentNodes[0].indexLeft = 'parent'; sources[0].indexLeft = 'data';
}
if(parentNodes[0]){
parentNodes[0].indexLeft = 'parent';
}
sources.push(...parentNodes); sources.push(...parentNodes);
@ -70,14 +74,17 @@ SV.registerLayout('PTree', {
layout(elements) { layout(elements) {
let nodeLength = elements.length, let nodeLength = elements.length;
halfLength = nodeLength / 2,
if(nodeLength == 0) return;
let halfLength = nodeLength / 2,
size = elements[0].get('size')[0], size = elements[0].get('size')[0],
i; i;
for (i = 0; i < nodeLength; i++) { for (i = 0; i < nodeLength; i++) {
let x = (i % halfLength) * size; let x = (i % halfLength) * size,
y = Math.floor(i / halfLength) * size; y = Math.floor(i / halfLength) * size;
elements[i].set({ x, y }); elements[i].set({ x, y });

9239
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -155,7 +155,7 @@ export class LayoutProvider {
}, },
left: (nodeBound: BoundingRect, labelBound: BoundingRect, offset: number) => { left: (nodeBound: BoundingRect, labelBound: BoundingRect, offset: number) => {
return { return {
x: nodeBound.x - labelBound.width - offset, x: nodeBound.x - labelBound.width / 2- offset,
y: nodeBound.y + nodeBound.height / 2, y: nodeBound.y + nodeBound.height / 2,
}; };
}, },
@ -164,7 +164,8 @@ export class LayoutProvider {
indexLabels.forEach(item => { indexLabels.forEach(item => {
const options: IndexLabelOption = indexLabelOptions[item.sourceType], const options: IndexLabelOption = indexLabelOptions[item.sourceType],
nodeBound = item.target.getBound(), nodeBound = item.target.getBound(),
labelBound = item.getBound(), // labelBound = item.getBound(),
labelBound = item.shadowG6Item.getContainer().getChildren()[1].getBBox(),
offset = options.offset ?? 20, offset = options.offset ?? 20,
position = options.position ?? 'bottom'; position = options.position ?? 'bottom';

5299
yarn.lock

File diff suppressed because it is too large Load Diff