43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
|
|
/*
|
||
|
|
* This file is part of the kernelstudio package.
|
||
|
|
*
|
||
|
|
* (c) 2014-2025 zlin <admin@kernelstudio.com>
|
||
|
|
*
|
||
|
|
* For the full copyright and license information, please view the LICENSE file
|
||
|
|
* that was distributed with this source code.
|
||
|
|
*/
|
||
|
|
|
||
|
|
export const createPort = (name: string = 'top', args: Record<any, any> = { dx: 0 }) => {
|
||
|
|
return {
|
||
|
|
position: { name: name, args: args },
|
||
|
|
attrs: {
|
||
|
|
circle: {
|
||
|
|
r: 3, // 大小
|
||
|
|
magnet: true,
|
||
|
|
stroke: '#999', // 边框颜色
|
||
|
|
strokeWidth: 1, // 边框大小
|
||
|
|
fill: '#ffffff', // 填充颜色
|
||
|
|
style: {
|
||
|
|
visibility: 'visible', // 是否可见
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
export const createPorts = () => {
|
||
|
|
return {
|
||
|
|
groups: {
|
||
|
|
top: createPort('top'),
|
||
|
|
right: createPort('right'),
|
||
|
|
bottom: createPort('bottom'),
|
||
|
|
left: createPort('left'),
|
||
|
|
},
|
||
|
|
items: [
|
||
|
|
{ group: 'top', id: 'top' },
|
||
|
|
{ group: 'right', id: 'right' },
|
||
|
|
{ group: 'bottom', id: 'bottom' },
|
||
|
|
{ group: 'left', id: 'left' },
|
||
|
|
],
|
||
|
|
};
|
||
|
|
};
|