姜玉琦 2024-07-14 22:25:50 +08:00
commit e75f470937
4 changed files with 55 additions and 18 deletions

View File

@ -100,7 +100,6 @@ class RedNodeModel extends RectNodeModel {
return style;
}
handleContextMenu(ev) {
debugger;
}
}
class RedNode extends RectNode {
@ -165,6 +164,7 @@ class RedNode extends RectNode {
getShape() {
const { text, x, y, width, height, radius } = this.props.model;
const style = this.props.model.getNodeStyle();
const fillColor=this.props.model.properties.fill||"#FFA726";
let subText=(this.props.model.properties?.data?.oper_sub_type_name||"");
let subType = (this.props.model.properties?.data?.oper_sub_type_name||"").split("").filter(t=>t.length>0).map((t,idx)=>{
return h("text",{
@ -240,6 +240,7 @@ class RedNode extends RectNode {
y: y - height / 2,
width,
height,
fill:fillColor,
rx: radius,
ry: radius,
}),

View File

@ -65,7 +65,7 @@ const config = {
style: themeApprove,
plugins: [AiNodeExtension, Menu]
};
const showFlow=(o)=>{
const showFlow=(o)=>{
info.opers=o.operator_list;
info.edges=o.operator_edges;
info.nodes=o.operator_nodes.map(it=>{

View File

@ -93,7 +93,6 @@ const initEvent=(lf)=>{
});
}
const doEdit=(n)=>{
debugger
}
const doUpdateState=()=>{
//nodePanel.value.updateNode(lf.value.getGraphData());

View File

@ -51,11 +51,11 @@ const dragNode = (it, t) => {
}
props.lf.dnd.startDrag({
type: 'ai-node',
text: it.text,
fill: color,
text: it.text,
properties: {
fill: color,
node: it.id,
data:it
data: it
}
})
}
@ -84,26 +84,25 @@ const list2 = reactive([
const updateNode = (nodes) => {
let nds = nodes.nodes.map(d => d.properties.node);
if(info.all){
if (info.all) {
info.all.forEach(d => {
d.show = nds.indexOf(d.id) == -1
});
}
}
const doEdit=(nd)=>{
debugger
let tmps=info.all.filter(d=>d.id==nd.id);
if(tmps.length>0){
tmps[0].inputs=nd.inputs;
tmps[0].outputs=nd.outputs;
tmps[0].process=nd.process;
const doEdit = (nd) => {
let tmps = info.all.filter(d => d.id == nd.id);
if (tmps.length > 0) {
tmps[0].inputs = nd.inputs;
tmps[0].outputs = nd.outputs;
tmps[0].process = nd.process;
}
}
defineExpose({
updateNode,
doEdit,
doEdit,
})
const initData = () => {
@ -111,10 +110,48 @@ const initData = () => {
let tmps = (d.data?.data?.operator_list || []).map(it => {
it.show = true;
it.text = it.operator_name;
it.id = it.operator_id
it.id = it.operator_id
if (!it.parameters) {
it.parameters = {
inputs: [{
input_id: 1,
oper_inout_data_type: "image_rgb24,image_gray8",
size_x: {
type: "int", //
value: 480, //
},
size_y: {
type: "int",
value: 480,
}
},],
outputs: [{
output_id: 1,
oper_inout_data_type: "same_as_input", //
size_x: {
type: "int", //
value: 580, //
},
size_y: {
type: "int",
value: 580,
},
scale: {
type: "float", //
value: 1.0, //
}
},],
process: {
method: {
type: "nearest/bilinear",
value: "nearest",
},
}
}
}
return it;
});
info.all=tmps;
info.all = tmps;
info.list1 = tmps.filter(d => d.oper_main_type == "pre_process");
info.list2 = tmps.filter(d => d.oper_main_type == "post_process");
info.list3 = tmps.filter(d => d.oper_main_type == "data_source");