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

Commit

Permalink
fix(selection bug): fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
tubiaoge committed Oct 15, 2020
1 parent beb390e commit b83447d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 31 deletions.
3 changes: 2 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ async function core() {
file: 'dist/luckysheet.esm.js',
format: 'esm',
name: 'luckysheet',
sourcemap: true
sourcemap: true,
inlineDynamicImports:true,
});
}

Expand Down
5 changes: 3 additions & 2 deletions src/controllers/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ let ExcelPlaceholder = {
// Get the pixel value per millimeter
function getOneMmsPx (){
let div = document.createElement("div");
div.id = "mm";
div.style.width = "1mm";
document.querySelector("body").appendChild(div);
let mm1 = document.getElementById("mm").getBoundingClientRect();
let mm1 = div.getBoundingClientRect();
let w = mm1.width;
$(div).remove();
return mm1.width;
}

Expand Down
35 changes: 13 additions & 22 deletions src/controllers/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,10 @@ function selectHightlightShow(isRestore=false) {
Store.luckysheet_select_save[i]["top"] = row_pre_f;
Store.luckysheet_select_save[i]["height"] = row_f - row_pre_f - 1;

if(isRestore){
Store.luckysheet_select_save[i]["left_move"] = col_pre_f;
Store.luckysheet_select_save[i]["width_move"] = col_f - col_pre_f - 1;
Store.luckysheet_select_save[i]["top_move"] = row_pre_f;
Store.luckysheet_select_save[i]["height_move"] = row_f - row_pre_f - 1;
}
else{

Store.luckysheet_select_save[i]["left_move"] = col_pre;
Store.luckysheet_select_save[i]["width_move"] = col - col_pre - 1;
Store.luckysheet_select_save[i]["top_move"] = row_pre;
Store.luckysheet_select_save[i]["height_move"] = row - row_pre - 1;
}
Store.luckysheet_select_save[i]["left_move"] = col_pre;
Store.luckysheet_select_save[i]["width_move"] = col - col_pre - 1;
Store.luckysheet_select_save[i]["top_move"] = row_pre;
Store.luckysheet_select_save[i]["height_move"] = row - row_pre - 1;

if(i == 0){
if(Store.luckysheet_select_save.length == 1){
Expand Down Expand Up @@ -201,16 +192,16 @@ function selectTitlesShow(rangeArr,isRestore=false) {
for(let i = 0; i < s.length; i++){
let r1 = s[i]["row"][0], r2 = s[i]["row"][1], c1 = s[i]["column"][0], c2 = s[i]["column"][1];

if(isRestore){
let margeset = menuButton.mergeborer(Store.flowdata, r1, c1);
if(!!margeset){
r1 = margeset.row[2];
r2 = margeset.row[3];
// if(isRestore){
// let margeset = menuButton.mergeborer(Store.flowdata, r1, c1);
// if(!!margeset){
// r1 = margeset.row[2];
// r2 = margeset.row[3];

c1 = margeset.column[2];
c2 = margeset.column[3];
}
}
// c1 = margeset.column[2];
// c2 = margeset.column[3];
// }
// }

//行、列标题栏
rowTitleMap = selectTitlesMap(rowTitleMap, r1, r2);
Expand Down
11 changes: 7 additions & 4 deletions src/controllers/sheetmanage.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ const sheetmanage = {
colwidth = c2 + 1;
}

Store.flowdata = data;
// Store.flowdata = data;

luckysheetcreatedom(colwidth, rowheight, data, menu, title);

Expand Down Expand Up @@ -721,7 +721,8 @@ const sheetmanage = {

let execF = function(){
_this.mergeCalculation(file["index"]);
editor.webWorkerFlowDataCache(Store.flowdata);//worker存数据
_this.setSheetParam(false);
// editor.webWorkerFlowDataCache(Store.flowdata);//worker存数据
_this.storeSheetParam();
_this.restoreselect();
_this.CacheNotLoadControll = [];
Expand Down Expand Up @@ -874,7 +875,7 @@ const sheetmanage = {

file["zoomRatio"] = Store.zoomRatio;
},
setSheetParam: function(isload) {
setSheetParam: function(isload=true) {
let index = this.getSheetIndex(Store.currentSheetIndex);
let file = Store.luckysheetfile[index];

Expand All @@ -896,7 +897,9 @@ const sheetmanage = {
luckysheetFreezen.freezenverticaldata = file["freezen"].vertical == null ? null : file["freezen"].vertical.freezenverticaldata;
}

rhchInit(Store.flowdata.length, Store.flowdata[0].length);
if(isload){
rhchInit(Store.flowdata.length, Store.flowdata[0].length);
}

//批注
luckysheetPostil.buildAllPs(Store.flowdata);
Expand Down
4 changes: 2 additions & 2 deletions src/global/createdom.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export default function luckysheetcreatedom(colwidth, rowheight, data, menu, tit
$("#luckysheet-cols-h-c").height((Store.columeHeaderHeight-1.5));
$("#luckysheet-left-top").css({width:Store.rowHeaderWidth-1.5, height:Store.columeHeaderHeight-1.5});

//批注
luckysheetPostil.buildAllPs(Store.flowdata);
// //批注
// luckysheetPostil.buildAllPs(Store.flowdata);

$("#luckysheet_info_detail_input").val(luckysheetConfigsetting.title);
}

0 comments on commit b83447d

Please sign in to comment.