Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
feat(row and column width): batch change the height and width of the …
Browse files Browse the repository at this point in the history
…selected row and column
  • Loading branch information
javahuang committed Oct 20, 2020
1 parent ef3d324 commit 956bd2a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
45 changes: 42 additions & 3 deletions src/controllers/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3339,7 +3339,26 @@ export default function luckysheetHandler() {

cfg["customHeight"][Store.luckysheet_rows_change_size_start[1]] = 1;

cfg["rowlen"][Store.luckysheet_rows_change_size_start[1]] = Math.ceil(size/Store.zoomRatio);
const changeRowIndex = Store.luckysheet_rows_change_size_start[1];
let changeRowSelected = false;
if(Store["luckysheet_select_save"].length > 0) {
Store["luckysheet_select_save"].filter(select => select.row_select).some((select) => {
if(changeRowIndex >= select.row[0] && changeRowIndex <= select.row[1]) {
changeRowSelected = true;
}
return changeRowSelected;
});
}
if(changeRowSelected) {
Store["luckysheet_select_save"].filter(select => select.row_select).forEach(select => {
for(let r = select.row[0]; r <= select.row[1]; r++) {
cfg["rowlen"][r] = Math.ceil(size/Store.zoomRatio);
}
})
}
else {
cfg["rowlen"][Store.luckysheet_rows_change_size_start[1]] = Math.ceil(size/Store.zoomRatio);
}

let images = imageCtrl.moveChangeSize("row", Store.luckysheet_rows_change_size_start[1], size);

Expand Down Expand Up @@ -3421,7 +3440,27 @@ export default function luckysheetHandler() {

cfg["customWidth"][Store.luckysheet_cols_change_size_start[1]] = 1;

cfg["columnlen"][Store.luckysheet_cols_change_size_start[1]] = Math.ceil(size/Store.zoomRatio);
const changeColumnIndex = Store.luckysheet_cols_change_size_start[1];
let changeColumnSelected = false;
if(Store["luckysheet_select_save"].length > 0) {
Store["luckysheet_select_save"].filter(select => select.column_select).some((select) => {
if(changeColumnIndex >= select.column[0] && changeColumnIndex <= select.column[1]) {
changeColumnSelected = true;
}
return changeColumnSelected;
});
}
if(changeColumnSelected) {
Store["luckysheet_select_save"].filter(select => select.column_select).forEach(select => {
for(let r = select.column[0]; r <= select.column[1]; r++) {
cfg["columnlen"][r] = Math.ceil(size/Store.zoomRatio);
}
})
}
else {
cfg["columnlen"][Store.luckysheet_cols_change_size_start[1]] = Math.ceil(size/Store.zoomRatio);
}


let images = imageCtrl.moveChangeSize("column", Store.luckysheet_cols_change_size_start[1], size);

Expand Down Expand Up @@ -4648,7 +4687,7 @@ export default function luckysheetHandler() {
$("#luckysheet-wa-functionbox-confirm").click();
Store.luckysheet_select_status = false;

Store.luckysheet_select_save = [{ "row": [0, Store.flowdata.length - 1], "column": [0, Store.flowdata[0].length - 1], "row_focus": 0, "column_focus": 0 }];
Store.luckysheet_select_save = [{ "row": [0, Store.flowdata.length - 1], "column": [0, Store.flowdata[0].length - 1], "row_focus": 0, "column_focus": 0, row_select: true, column_select: true }];
selectHightlightShow();

clearTimeout(Store.countfuncTimeout);
Expand Down
12 changes: 8 additions & 4 deletions src/controllers/rowColumnOperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ export function rowColumnOperationInitial(){
"row": rowseleted,
"column": [0, col_index],
"row_focus": row_index,
"column_focus": 0
"column_focus": 0,
"row_select": true
});
}
else{
Expand All @@ -333,7 +334,8 @@ export function rowColumnOperationInitial(){
"row": rowseleted,
"column": [0, col_index],
"row_focus": row_index,
"column_focus": 0
"column_focus": 0,
"row_select": true
});
}

Expand Down Expand Up @@ -691,7 +693,8 @@ export function rowColumnOperationInitial(){
"row": [0, row_index],
"column": columnseleted,
"row_focus": 0,
"column_focus": col_index
"column_focus": col_index,
"column_select": true
});
}
else{
Expand All @@ -708,7 +711,8 @@ export function rowColumnOperationInitial(){
"row": [0, row_index],
"column": columnseleted,
"row_focus": 0,
"column_focus": col_index
"column_focus": col_index,
"column_select": true
});
}

Expand Down

0 comments on commit 956bd2a

Please sign in to comment.