fix: dragging to adjust td width boundary error #569
This commit is contained in:
@@ -285,25 +285,27 @@ export class TableTool {
|
|||||||
dx = nextColWidth - this.MIN_TD_WIDTH
|
dx = nextColWidth - this.MIN_TD_WIDTH
|
||||||
}
|
}
|
||||||
const moveColWidth = curColWidth + dx
|
const moveColWidth = curColWidth + dx
|
||||||
// 开始移动
|
// 开始移动,只有表格的最后一列线才会改变表格的宽度,其他场景不用计算表格超出
|
||||||
let moveTableWidth = 0
|
if (index === colgroup.length - 1) {
|
||||||
for (let c = 0; c < colgroup.length; c++) {
|
let moveTableWidth = 0
|
||||||
const group = colgroup[c]
|
for (let c = 0; c < colgroup.length; c++) {
|
||||||
// 下一列减去偏移量
|
const group = colgroup[c]
|
||||||
if (c === index + 1) {
|
// 下一列减去偏移量
|
||||||
moveTableWidth -= dx
|
if (c === index + 1) {
|
||||||
|
moveTableWidth -= dx
|
||||||
|
}
|
||||||
|
// 当前列加上偏移量
|
||||||
|
if (c === index) {
|
||||||
|
moveTableWidth += moveColWidth
|
||||||
|
}
|
||||||
|
if (c !== index) {
|
||||||
|
moveTableWidth += group.width
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 当前列加上偏移量
|
if (moveTableWidth > innerWidth) {
|
||||||
if (c === index) {
|
const tableWidth = element.width!
|
||||||
moveTableWidth += moveColWidth
|
dx = innerWidth - tableWidth
|
||||||
}
|
}
|
||||||
if (c !== index) {
|
|
||||||
moveTableWidth += group.width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (moveTableWidth > innerWidth) {
|
|
||||||
const tableWidth = element.width!
|
|
||||||
dx = innerWidth - tableWidth
|
|
||||||
}
|
}
|
||||||
if (dx) {
|
if (dx) {
|
||||||
// 当前列增加,后列减少
|
// 当前列增加,后列减少
|
||||||
|
|||||||
Reference in New Issue
Block a user