代码如下,其中sheet.shapes.group方法执行后,shapeRemoved事件触发了,预期是不触发。请问怎么解决?
const {row,col,rowCount,colCount} = selectedAreaInfo;const {left,right,top,bottom} = calcPositionOfSelectedArea(selectedAreaInfo);
const shapeColor = 'red';
const shapeName = 'shapeName';
const sheet = getActiveSheet_tool();
let groupShapes = [
{
flag:"_top",
params:[left, top, right, top]
},
{
flag:"_bottom",
params:[left, bottom, right, bottom]
},
{
flag:"_left",
params:[left, top, left, bottom]
},
{
flag:"_right",
params:[right, top, right, bottom]
}
].map(item=>{
let tempShape = sheet.shapes.addConnector(shapeName + item.flag,
GC.Spread.Sheets.Shapes.ConnectorType.straight, ...item.params);
let oldStyle = tempShape.style();
oldStyle.line.color = shapeColor;
tempShape.style(oldStyle);
return tempShape;
})
let gShape = sheet.shapes.group(groupShapes); //触发了shapeRemoved事件
return false;
let nameTemp = shapeName + "_group_" + new Date().getTime();
gShape.name(nameTemp);
// if(/*打上tag之前调用*/isShapesHaveIntersection()){
// removeOneShape(nameTemp,false);//不可删除交集上的tag。
// return toastr.warning('不可以有交集哦')
// }
gShape.allowMove(false);
gShape.allowResize(false);
gShape.allowRotate(false);
//对shape里的cell设置tag
for(let i=row;i<row+rowCount;i++){
for(let j=col;j<col+colCount;j++){
const {shapeName} = getTag_tool(i,j);
setTag_tool(i,j,{shapeName: shapeName ? [nameTemp,shapeName].join(window.defineVarObj_g.shapeNameSeparator) : nameTemp});
}
}
shapesInfoHandler_shapeHelper({type:'addShape',shapeName:nameTemp,cellsInfo:{/*row,col,*/rowCount,colCount}});
|