UPDATE: VERSION-20260315

This commit is contained in:
libertyspy
2026-03-15 19:32:20 +08:00
parent 83a38c6db8
commit f2e81c6e5c
16 changed files with 197 additions and 178 deletions

View File

@@ -0,0 +1,42 @@
/*
* This file is part of the kernelstudio package.
*
* (c) 2014-2026 zlin <admin@kernelstudio.com>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/
import type { GraphRect, GraphTaskElement } from '../graph';
import { generateKey } from '@/utils/strings';
import type { PlatformWithComponents } from './types';
export const createGraphTaskElementFromScenario = (
platform: PlatformWithComponents,
rect?: GraphRect,
): GraphTaskElement => {
let realRect = { width: 120, height: 80, x: 0, y: 0, ...rect || {} };
console.info('rect', rect);
return {
id: 0,
key: generateKey(),
type: 'scenario',
template: platform.id,
templateType: null,
name: null,
category: null,
group: null,
description: platform.description,
order: 0,
position: {
x: realRect.x ?? 0,
y: realRect.y ?? 0,
},
width: realRect.width,
height: realRect.height,
inputs: null,
outputs: null,
parameters: [],
variables: [],
} as GraphTaskElement;
};