你好,
我这里有加这个小问题。
现在复制图片到单元格之后,双击旁边的单元格,还是会有一部分,能够双击到图片。
- onMounted(() => {
- setTimeout(() => {
- dblclickAction();
- }, 1000);
- })
复制代码
- const dblclickAction = ()=>{
- let Designer = GC.Spread.Sheets.Designer.findControl('designer-container');
- let spread = Designer.getWorkbook()
- let sheet = spread.getActiveSheet();
- // let sheet = spread.getSheet(1);
- // console.log(sheet.shapes.all(), '--sheet.shapes.all()--')
- document.getElementById('designer-container').addEventListener('dblclick', function (e) {
- let _x = e.pageX - 28
- let offsetLeft = 58;
- if (!Designer.getData("isRibbonCollapse")) {
- offsetLeft = 174
- }
- let _y = e.pageY - offsetLeft;
- // let _x = e.pageX - this.offsetLeft
- // let _y = e.pageY - this.offsetTop
- console.log("e.pageX",_x,",this.offsetTop",_y)
- // isSaveOk(spread);
- let result = spread.hitTest(_x, _y)
- var {row, col} = getHitAreaName(result);
- // let sheet = spread.getActiveSheet();
- // let sheet = spread.getSheet(1);
- // console.log(sheet.shapes.all(), '-----所有值---', row, col)
- for (let i = 0; i < sheet.shapes.all().length; i++) {
- if (sheet.shapes.all()[i] instanceof GC.Spread.Sheets.Shapes.PictureShape) {
- let pic = sheet.shapes.all()[i]
- let startRow = pic.startRow()
- let endRow = pic.endRow()
- let startColumn = pic.startColumn()
- let endColumn = pic.endColumn()
- // console.log(row, col, '----参数---', startRow, '---', endRow, '---pic--', pic, '---endColumn---',endColumn)
- // console.log(row >= startRow && row <= endRow, '----',col >= startColumn)
- // if (row >= startRow && row <= endRow && col >= startColumn && col <= endColumn) {
- if (row >= startRow && row <= endRow && col >= startColumn && col <= endColumn) {
- // if (row >= startRow && row < endRow && col >= startColumn && col < endColumn) {
- // console.log(startRow,endRow,startColumn,endColumn)
- // console.log(pic,"----当前图片双击", pic.name())
- dioImgConfig(pic.ctV.McV.src)
- }
- }
- }
- });
复制代码
|