diff --git a/react-ui/src/pages/Experiment/experimentText/index.jsx b/react-ui/src/pages/Experiment/experimentText/index.jsx index baa5bd0..a5ed2ff 100644 --- a/react-ui/src/pages/Experiment/experimentText/index.jsx +++ b/react-ui/src/pages/Experiment/experimentText/index.jsx @@ -68,19 +68,9 @@ function ExperimentText() { }; const formChange = (val) => {}; const handlerClick = (e) => { - console.log(propsRef, graph, messageRef.current); - // let cache = []; - // let json_str = JSON.stringify(graph, function(key, value) { - // if (typeof value === 'object' && value !== null) { - // if (cache.indexOf(value) !== -1) { - // return; - // } - // cache.push(value); - // } - // return value; - // }); - // console.log(json_str); - propsRef.current.showDrawer(e, locationParams.id, messageRef.current); + if (e.target.get('name') !== 'anchor-point' && e.item) { + propsRef.current.showDrawer(e, locationParams.id, messageRef.current); + } }; const getGraphData = (data) => { if (graph) { @@ -387,8 +377,7 @@ function ExperimentText() { fitView: true, fitViewPadding: [320, 320, 220, 320], }); - - graph.on('dblclick', handlerClick); + graph.on('node:click', handlerClick); window.onresize = () => { if (!graph || graph.get('destroyed')) return; if (!graphRef.current || !graphRef.current.scrollWidth || !graphRef.current.scrollHeight) diff --git a/react-ui/src/pages/Pipeline/editPipeline/index.jsx b/react-ui/src/pages/Pipeline/editPipeline/index.jsx index af9e604..406468e 100644 --- a/react-ui/src/pages/Pipeline/editPipeline/index.jsx +++ b/react-ui/src/pages/Pipeline/editPipeline/index.jsx @@ -128,18 +128,7 @@ const EditPipeline = () => { }; const handlerClick = (e) => { e.stopPropagation(); - console.log(propsRef, graph); - // let cache = []; - // let json_str = JSON.stringify(graph, function(key, value) { - // if (typeof value === 'object' && value !== null) { - // if (cache.indexOf(value) !== -1) { - // return; - // } - // cache.push(value); - // } - // return value; - // }); - // console.log(json_str); + // console.log(propsRef, graph); propsRef.current.showDrawer(e); }; const getGraphData = (data) => { @@ -353,7 +342,7 @@ const EditPipeline = () => { // this.graph.setItemState(e.item, 'showAnchors', false); graph.setItemState(e.item, 'nodeSelected', false); }); - graph.off('dblclick', handlerClick); + // graph.off('dblclick', handlerClick); }; }, []); const initGraph = () => { @@ -390,32 +379,15 @@ const EditPipeline = () => { getAnchorPoints(cfg) { return ( cfg.anchorPoints || [ - // 上下各3,左右各1 - [0.5, 0], - [0.5, 1], + // 四个 + // [0.5, 0], + // [0.5, 1], [0, 0.5], [1, 0.5], ] ); }, - // draw(cfg, group) { - - // let rect=group.addShape('text', { - // attrs: { - // text: fittingString(cfg.label, 110, 15), - // x: 90 - getTextSize(cfg.label, 110, 15), - // y: 0, - // fontSize: 10, - // textAlign: 'center', - // textBaseline: 'middle', - // fill:'#000' - // }, - // name: 'text-shape', - // }); - // return rect; - // }, afterDraw(cfg, group) { - // console.log(group, cfg, 12312); const image = group.addShape('image', { attrs: { x: -45, @@ -444,7 +416,6 @@ const EditPipeline = () => { } const bbox = group.getBBox(); const anchorPoints = this.getAnchorPoints(cfg); - // console.log(anchorPoints); anchorPoints.forEach((anchorPos, i) => { group.addShape('circle', { attrs: { @@ -578,7 +549,7 @@ const EditPipeline = () => { }, defaultEdge: { // type: 'quadratic', - type: 'cubic-vertical', + // type: 'cubic-vertical', style: { endArrow: { @@ -631,13 +602,9 @@ const EditPipeline = () => { // }); graph.on('node:click', (e) => { console.log(e.target.get('name')); - if (e.target.get('name') === 'anchor-point') { - // create edge - } else { - if (e.item) { - graph.setItemState(e.item, 'nodeClicked', true); - handlerClick(e); - } + if (e.target.get('name') !== 'anchor-point' && e.item) { + graph.setItemState(e.item, 'nodeClicked', true); + handlerClick(e); } }); graph.on('aftercreateedge', (e) => {