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

Commit

Permalink
fix(bug): bug
Browse files Browse the repository at this point in the history
bug
  • Loading branch information
wpxp123456 committed Sep 23, 2020
1 parent 606e054 commit 0cb1ec2
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 158 deletions.
277 changes: 137 additions & 140 deletions src/controllers/freezen.js
Original file line number Diff line number Diff line change
Expand Up @@ -1563,186 +1563,183 @@ const luckysheetFreezen = {
Store.luckysheetfile[order]["frozen"] = frozen[operate];
},
frozenTofreezen: function() {

// get frozen type
const frozen = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["frozen"];
let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
const frozen = file["frozen"];

if(frozen == null){
return;
}

let freezen = null;

// transform to freezen
if(frozen.type === 'row'){
let scrollTop = $("#luckysheet-cell-main").scrollTop();
let row_st = luckysheet_searcharray(Store.visibledatarow, scrollTop);
if(row_st == -1){
row_st = 0;
}
let top = Store.visibledatarow[row_st] - 2 - scrollTop + Store.columeHeaderHeight;
let freezenhorizontaldata = [Store.visibledatarow[row_st], row_st + 1, scrollTop, luckysheetFreezen.cutVolumn(Store.visibledatarow, row_st + 1), top];

freezen = {
horizontal:{
freezenhorizontaldata: freezenhorizontaldata,
top: top
}
}

}
else if(frozen.type === 'column'){
let scrollLeft = $("#luckysheet-cell-main").scrollLeft();
let col_st = luckysheet_searcharray(Store.visibledatacolumn, scrollLeft);
if(col_st == -1){
col_st = 0;
}
let left = Store.visibledatacolumn[col_st] - 2 - scrollLeft + Store.rowHeaderWidth;
let freezenverticaldata = [Store.visibledatacolumn[col_st], col_st + 1, scrollLeft, luckysheetFreezen.cutVolumn(Store.visibledatacolumn, col_st + 1), left];
if(file["freezen"] == null){
let freezen = null;

freezen = {
vertical:{
freezenverticaldata: freezenverticaldata,
left: left
// transform to freezen
if(frozen.type === 'row'){
let scrollTop = 0;
let row_st = luckysheet_searcharray(Store.visibledatarow, scrollTop);
if(row_st == -1){
row_st = 0;
}
let top = Store.visibledatarow[row_st] - 2 - scrollTop + Store.columeHeaderHeight;
let freezenhorizontaldata = [Store.visibledatarow[row_st], row_st + 1, scrollTop, luckysheetFreezen.cutVolumn(Store.visibledatarow, row_st + 1), top];

freezen = {
horizontal:{
freezenhorizontaldata: freezenhorizontaldata,
top: top
}
}
}
}
else if(frozen.type === 'both'){
let scrollTop = $("#luckysheet-cell-main").scrollTop();
let row_st = luckysheet_searcharray(Store.visibledatarow, scrollTop);
if(row_st == -1){
row_st = 0;
}
let top = Store.visibledatarow[row_st] - 2 - scrollTop + Store.columeHeaderHeight;
let freezenhorizontaldata = [Store.visibledatarow[row_st], row_st + 1, scrollTop, luckysheetFreezen.cutVolumn(Store.visibledatarow, row_st + 1), top];

freezen = {

}

let scrollLeft = $("#luckysheet-cell-main").scrollLeft();
let col_st = luckysheet_searcharray(Store.visibledatacolumn, scrollLeft);
if(col_st == -1){
col_st = 0;
}
let left = Store.visibledatacolumn[col_st] - 2 - scrollLeft + Store.rowHeaderWidth;
let freezenverticaldata = [Store.visibledatacolumn[col_st], col_st + 1, scrollLeft, luckysheetFreezen.cutVolumn(Store.visibledatacolumn, col_st + 1), left];

freezen = {
horizontal:{
freezenhorizontaldata: freezenhorizontaldata,
top: top
},
vertical:{
freezenverticaldata: freezenverticaldata,
left: left
else if(frozen.type === 'column'){
let scrollLeft = 0;
let col_st = luckysheet_searcharray(Store.visibledatacolumn, scrollLeft);
if(col_st == -1){
col_st = 0;
}
let left = Store.visibledatacolumn[col_st] - 2 - scrollLeft + Store.rowHeaderWidth;
let freezenverticaldata = [Store.visibledatacolumn[col_st], col_st + 1, scrollLeft, luckysheetFreezen.cutVolumn(Store.visibledatacolumn, col_st + 1), left];

freezen = {
vertical:{
freezenverticaldata: freezenverticaldata,
left: left
}
}
}
else if(frozen.type === 'both'){
let scrollTop = 0;
let row_st = luckysheet_searcharray(Store.visibledatarow, scrollTop);
if(row_st == -1){
row_st = 0;
}
let top = Store.visibledatarow[row_st] - 2 - scrollTop + Store.columeHeaderHeight;
let freezenhorizontaldata = [Store.visibledatarow[row_st], row_st + 1, scrollTop, luckysheetFreezen.cutVolumn(Store.visibledatarow, row_st + 1), top];

let scrollLeft = 0;
let col_st = luckysheet_searcharray(Store.visibledatacolumn, scrollLeft);
if(col_st == -1){
col_st = 0;
}
let left = Store.visibledatacolumn[col_st] - 2 - scrollLeft + Store.rowHeaderWidth;
let freezenverticaldata = [Store.visibledatacolumn[col_st], col_st + 1, scrollLeft, luckysheetFreezen.cutVolumn(Store.visibledatacolumn, col_st + 1), left];

freezen = {
horizontal:{
freezenhorizontaldata: freezenhorizontaldata,
top: top
},
vertical:{
freezenverticaldata: freezenverticaldata,
left: left
}
}

}
else if(frozen.type === 'rangeRow'){
let scrollTop = $("#luckysheet-cell-main").scrollTop();
let row_st = luckysheet_searcharray(Store.visibledatarow, scrollTop);

let row_focus = frozen.range["row_focus"];

if(row_focus > row_st){
row_st = row_focus;
}

if(row_st == -1){
row_st = 0;
}
else if(frozen.type === 'rangeRow'){
let scrollTop = 0;
let row_st = luckysheet_searcharray(Store.visibledatarow, scrollTop);

let top = Store.visibledatarow[row_st] - 2 - scrollTop + Store.columeHeaderHeight;
let freezenhorizontaldata = [Store.visibledatarow[row_st], row_st + 1, scrollTop, luckysheetFreezen.cutVolumn(Store.visibledatarow, row_st + 1), top];
let row_focus = frozen.range["row_focus"];

freezen = {
horizontal:{
freezenhorizontaldata: freezenhorizontaldata,
top: top
if(row_focus > row_st){
row_st = row_focus;
}

if(row_st == -1){
row_st = 0;
}
}

}
else if(frozen.type === 'rangeColumn'){
let scrollLeft = $("#luckysheet-cell-main").scrollLeft();
let col_st = luckysheet_searcharray(Store.visibledatacolumn, scrollLeft);
let top = Store.visibledatarow[row_st] - 2 - scrollTop + Store.columeHeaderHeight;
let freezenhorizontaldata = [Store.visibledatarow[row_st], row_st + 1, scrollTop, luckysheetFreezen.cutVolumn(Store.visibledatarow, row_st + 1), top];

let column_focus = frozen.range["column_focus"];
freezen = {
horizontal:{
freezenhorizontaldata: freezenhorizontaldata,
top: top
}
}

if(column_focus > col_st){
col_st = column_focus;
}
else if(frozen.type === 'rangeColumn'){
let scrollLeft = 0;
let col_st = luckysheet_searcharray(Store.visibledatacolumn, scrollLeft);

if(col_st == -1){
col_st = 0;
}
let column_focus = frozen.range["column_focus"];

let left = Store.visibledatacolumn[col_st] - 2 - scrollLeft + Store.rowHeaderWidth;
let freezenverticaldata = [Store.visibledatacolumn[col_st], col_st + 1, scrollLeft, luckysheetFreezen.cutVolumn(Store.visibledatacolumn, col_st + 1), left];
if(column_focus > col_st){
col_st = column_focus;
}

freezen = {
vertical:{
freezenverticaldata: freezenverticaldata,
left: left
if(col_st == -1){
col_st = 0;
}
}

}
else if(frozen.type === 'rangeBoth'){
let scrollTop = $("#luckysheet-cell-main").scrollTop();
let row_st = luckysheet_searcharray(Store.visibledatarow, scrollTop);
let left = Store.visibledatacolumn[col_st] - 2 - scrollLeft + Store.rowHeaderWidth;
let freezenverticaldata = [Store.visibledatacolumn[col_st], col_st + 1, scrollLeft, luckysheetFreezen.cutVolumn(Store.visibledatacolumn, col_st + 1), left];

let row_focus = frozen.range["row_focus"];
freezen = {
vertical:{
freezenverticaldata: freezenverticaldata,
left: left
}
}

if(row_focus > row_st){
row_st = row_focus;
}

if(row_st == -1){
row_st = 0;
}
else if(frozen.type === 'rangeBoth'){
let scrollTop = 0;
let row_st = luckysheet_searcharray(Store.visibledatarow, scrollTop);

let top = Store.visibledatarow[row_st] - 2 - scrollTop + Store.columeHeaderHeight;
let freezenhorizontaldata = [Store.visibledatarow[row_st], row_st + 1, scrollTop, luckysheetFreezen.cutVolumn(Store.visibledatarow, row_st + 1), top];
let row_focus = frozen.range["row_focus"];

let scrollLeft = $("#luckysheet-cell-main").scrollLeft();
let col_st = luckysheet_searcharray(Store.visibledatacolumn, scrollLeft);
if(row_focus > row_st){
row_st = row_focus;
}

if(row_st == -1){
row_st = 0;
}

let column_focus = frozen.range["column_focus"];
let top = Store.visibledatarow[row_st] - 2 - scrollTop + Store.columeHeaderHeight;
let freezenhorizontaldata = [Store.visibledatarow[row_st], row_st + 1, scrollTop, luckysheetFreezen.cutVolumn(Store.visibledatarow, row_st + 1), top];

if(column_focus > col_st){
col_st = column_focus;
}
let scrollLeft = 0;
let col_st = luckysheet_searcharray(Store.visibledatacolumn, scrollLeft);

if(col_st == -1){
col_st = 0;
}
let column_focus = frozen.range["column_focus"];

if(column_focus > col_st){
col_st = column_focus;
}

let left = Store.visibledatacolumn[col_st] - 2 - scrollLeft + Store.rowHeaderWidth;
let freezenverticaldata = [Store.visibledatacolumn[col_st], col_st + 1, scrollLeft, luckysheetFreezen.cutVolumn(Store.visibledatacolumn, col_st + 1), left];
if(col_st == -1){
col_st = 0;
}

let left = Store.visibledatacolumn[col_st] - 2 - scrollLeft + Store.rowHeaderWidth;
let freezenverticaldata = [Store.visibledatacolumn[col_st], col_st + 1, scrollLeft, luckysheetFreezen.cutVolumn(Store.visibledatacolumn, col_st + 1), left];

freezen = {
horizontal:{
freezenhorizontaldata: freezenhorizontaldata,
top: top
},
vertical:{
freezenverticaldata: freezenverticaldata,
left: left
freezen = {
horizontal:{
freezenhorizontaldata: freezenhorizontaldata,
top: top
},
vertical:{
freezenverticaldata: freezenverticaldata,
left: left
}
}
}
}
else if(frozen.type === 'cancel'){
freezen = {
horizontal: null,
vertical: null
else if(frozen.type === 'cancel'){
freezen = {
horizontal: null,
vertical: null
}
}
}

Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)]["freezen"] = freezen;

file["freezen"] = freezen;
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/controllers/searchReplace.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ const luckysheetSearchReplace = {
const _locale = locale();
const locale_findAndReplace = _locale.findAndReplace;

if(!Store.allowEdit){
tooltip.info(locale_findAndReplace.modeTip, "");
return;
}

let searchText = $("#luckysheet-search-replace #searchInput input").val();
if(searchText == "" || searchText == null){
if(isEditMode()){
Expand Down Expand Up @@ -628,6 +633,11 @@ const luckysheetSearchReplace = {
const _locale = locale();
const locale_findAndReplace = _locale.findAndReplace;

if(!Store.allowEdit){
tooltip.info(locale_findAndReplace.modeTip, "");
return;
}

let searchText = $("#luckysheet-search-replace #searchInput input").val();
if(searchText == "" || searchText == null){
if(isEditMode()){
Expand Down
Loading

0 comments on commit 0cb1ec2

Please sign in to comment.