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

View File

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

View File

@ -52,10 +52,10 @@ const dragNode = (it, t) => {
props.lf.dnd.startDrag({ props.lf.dnd.startDrag({
type: 'ai-node', type: 'ai-node',
text: it.text, text: it.text,
fill: color,
properties: { properties: {
fill: color,
node: it.id, node: it.id,
data:it data: it
} }
}) })
} }
@ -84,7 +84,7 @@ const list2 = reactive([
const updateNode = (nodes) => { const updateNode = (nodes) => {
let nds = nodes.nodes.map(d => d.properties.node); let nds = nodes.nodes.map(d => d.properties.node);
if(info.all){ if (info.all) {
info.all.forEach(d => { info.all.forEach(d => {
d.show = nds.indexOf(d.id) == -1 d.show = nds.indexOf(d.id) == -1
}); });
@ -92,13 +92,12 @@ const updateNode = (nodes) => {
} }
const doEdit=(nd)=>{ const doEdit = (nd) => {
debugger let tmps = info.all.filter(d => d.id == nd.id);
let tmps=info.all.filter(d=>d.id==nd.id); if (tmps.length > 0) {
if(tmps.length>0){ tmps[0].inputs = nd.inputs;
tmps[0].inputs=nd.inputs; tmps[0].outputs = nd.outputs;
tmps[0].outputs=nd.outputs; tmps[0].process = nd.process;
tmps[0].process=nd.process;
} }
} }
defineExpose({ defineExpose({
@ -112,9 +111,47 @@ const initData = () => {
it.show = true; it.show = true;
it.text = it.operator_name; 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; return it;
}); });
info.all=tmps; info.all = tmps;
info.list1 = tmps.filter(d => d.oper_main_type == "pre_process"); info.list1 = tmps.filter(d => d.oper_main_type == "pre_process");
info.list2 = tmps.filter(d => d.oper_main_type == "post_process"); info.list2 = tmps.filter(d => d.oper_main_type == "post_process");
info.list3 = tmps.filter(d => d.oper_main_type == "data_source"); info.list3 = tmps.filter(d => d.oper_main_type == "data_source");