Browse Source

fix(bug): bug

freeze bug

fix #67, fix #85
master
wpxp123456 5 years ago
parent
commit
f8716c18db
  1. 168
      src/controllers/freezen.js
  2. 16
      src/controllers/handler.js
  3. 45
      src/controllers/updateCell.js

168
src/controllers/freezen.js

@ -1176,61 +1176,73 @@ const luckysheetFreezen = {
let show = true; let show = true;
let show2 = true; let show2 = true;
if(postil_top + postil_height < freezenTop){ if(r >= _this.freezenhorizontaldata[1]){
$(e).show().find(".luckysheet-postil-show-main").css("top", postil_top + offTop); if(postil_top + postil_height < freezenTop){
$(e).show().find(".arrowCanvas").css("top", size[1] + offTop); $(e).show().find(".luckysheet-postil-show-main").css("top", postil_top + offTop);
} $(e).show().find(".arrowCanvas").css("top", size[1] + offTop);
else{ }
if(postil_top < freezenTop + offTop){ else{
if(postil_top + postil_height <= freezenTop + offTop){ if(postil_top < freezenTop + offTop){
show = false; if(postil_top + postil_height <= freezenTop + offTop){
show = false;
}
else{
$(e).show().find(".luckysheet-postil-show-main").css({ "top": freezenTop + offTop, "height": postil_height - (freezenTop + offTop - postil_top) });
$(e).show().find(".formulaInputFocus").css("margin-top", -(freezenTop + offTop - postil_top));
$(e).show().find(".arrowCanvas").hide();
show2 = false;
}
} }
else{ else{
$(e).show().find(".luckysheet-postil-show-main").css({ "top": freezenTop + offTop, "height": postil_height - (freezenTop + offTop - postil_top) }); $(e).show().find(".luckysheet-postil-show-main").css({
$(e).show().find(".formulaInputFocus").css("margin-top", -(freezenTop + offTop - postil_top)); "top": postil_top,
$(e).show().find(".arrowCanvas").hide(); "height": postil_height
});
show2 = false; $(e).show().find(".formulaInputFocus").css("margin-top", 0);
$(e).show().find(".arrowCanvas").css("top", size[1]);
// luckysheetPostil.buildPs(r, c, postil);
} }
} }
else{
$(e).show().find(".luckysheet-postil-show-main").css({
"top": postil_top,
"height": postil_height
});
$(e).show().find(".formulaInputFocus").css("margin-top", 0);
$(e).show().find(".arrowCanvas").css("top", size[1]);
// luckysheetPostil.buildPs(r, c, postil);
}
}
if(postil_left + postil_width < freezenLeft){
$(e).show().find(".luckysheet-postil-show-main").css("left", postil_left + offLeft);
$(e).show().find(".arrowCanvas").css("left", size[0] + offLeft);
} }
else{ else{
if(postil_left < freezenLeft + offLeft){ $(e).show().find(".luckysheet-postil-show-main").css("top", postil_top + offTop);
if(postil_left + postil_width <= freezenLeft + offLeft){ $(e).show().find(".arrowCanvas").css("top", size[1] + offTop);
show = false; }
}
else{
$(e).show().find(".luckysheet-postil-show-main").css({ "left": freezenLeft + offLeft, "width": postil_width - (freezenLeft + offLeft - postil_left) });
$(e).show().find(".formulaInputFocus").css("margin-left", -(freezenLeft + offLeft - postil_left));
$(e).show().find(".arrowCanvas").hide();
show2 = false; if(c >= _this.freezenverticaldata[1]){
} if(postil_left + postil_width < freezenLeft){
$(e).show().find(".luckysheet-postil-show-main").css("left", postil_left + offLeft);
$(e).show().find(".arrowCanvas").css("left", size[0] + offLeft);
} }
else{ else{
$(e).show().find(".luckysheet-postil-show-main").css({ if(postil_left < freezenLeft + offLeft){
"left": postil_left, if(postil_left + postil_width <= freezenLeft + offLeft){
"width": postil_width show = false;
}); }
$(e).show().find(".formulaInputFocus").css("margin-left", 0); else{
$(e).show().find(".arrowCanvas").css("left", size[0]); $(e).show().find(".luckysheet-postil-show-main").css({ "left": freezenLeft + offLeft, "width": postil_width - (freezenLeft + offLeft - postil_left) });
// luckysheetPostil.buildPs(r, c, postil); $(e).show().find(".formulaInputFocus").css("margin-left", -(freezenLeft + offLeft - postil_left));
$(e).show().find(".arrowCanvas").hide();
show2 = false;
}
}
else{
$(e).show().find(".luckysheet-postil-show-main").css({
"left": postil_left,
"width": postil_width
});
$(e).show().find(".formulaInputFocus").css("margin-left", 0);
$(e).show().find(".arrowCanvas").css("left", size[0]);
// luckysheetPostil.buildPs(r, c, postil);
}
} }
} }
else{
$(e).show().find(".luckysheet-postil-show-main").css("left", postil_left + offLeft);
$(e).show().find(".arrowCanvas").css("left", size[0] + offLeft);
}
if(!show){ if(!show){
$(e).hide(); $(e).hide();
@ -1281,24 +1293,30 @@ const luckysheetFreezen = {
let size = luckysheetPostil.getArrowCanvasSize(postil_left, postil_top, toX, toY); let size = luckysheetPostil.getArrowCanvasSize(postil_left, postil_top, toX, toY);
if(postil_top + postil_height < freezenTop){ if(r >= _this.freezenhorizontaldata[1]){
$(e).show().find(".luckysheet-postil-show-main").css("top", postil_top + offTop); if(postil_top + postil_height < freezenTop){
$(e).show().find(".arrowCanvas").css("top", size[1] + offTop); $(e).show().find(".luckysheet-postil-show-main").css("top", postil_top + offTop);
} $(e).show().find(".arrowCanvas").css("top", size[1] + offTop);
else{ }
if(postil_top < freezenTop + offTop){ else{
if(postil_top + postil_height <= freezenTop + offTop){ if(postil_top < freezenTop + offTop){
$(e).hide(); if(postil_top + postil_height <= freezenTop + offTop){
$(e).hide();
}
else{
$(e).show().find(".luckysheet-postil-show-main").css({ "top": freezenTop + offTop, "height": postil_height - (freezenTop + offTop - postil_top) });
$(e).show().find(".formulaInputFocus").css("margin-top", -(freezenTop + offTop - postil_top));
$(e).show().find(".arrowCanvas").hide();
}
} }
else{ else{
$(e).show().find(".luckysheet-postil-show-main").css({ "top": freezenTop + offTop, "height": postil_height - (freezenTop + offTop - postil_top) }); luckysheetPostil.buildPs(r, c, postil);
$(e).show().find(".formulaInputFocus").css("margin-top", -(freezenTop + offTop - postil_top));
$(e).show().find(".arrowCanvas").hide();
} }
} }
else{ }
luckysheetPostil.buildPs(r, c, postil); else{
} $(e).show().find(".luckysheet-postil-show-main").css("top", postil_top + offTop);
$(e).show().find(".arrowCanvas").css("top", size[1] + offTop);
} }
}) })
} }
@ -1342,24 +1360,30 @@ const luckysheetFreezen = {
let size = luckysheetPostil.getArrowCanvasSize(postil_left, postil_top, toX, toY); let size = luckysheetPostil.getArrowCanvasSize(postil_left, postil_top, toX, toY);
if(postil_left + postil_width < freezenLeft){ if(c >= _this.freezenverticaldata[1]){
$(e).show().find(".luckysheet-postil-show-main").css("left", postil_left + offLeft); if(postil_left + postil_width < freezenLeft){
$(e).show().find(".arrowCanvas").css("left", size[0] + offLeft); $(e).show().find(".luckysheet-postil-show-main").css("left", postil_left + offLeft);
} $(e).show().find(".arrowCanvas").css("left", size[0] + offLeft);
else{ }
if(postil_left < freezenLeft + offLeft){ else{
if(postil_left + postil_width <= freezenLeft + offLeft){ if(postil_left < freezenLeft + offLeft){
$(e).hide(); if(postil_left + postil_width <= freezenLeft + offLeft){
$(e).hide();
}
else{
$(e).show().find(".luckysheet-postil-show-main").css({ "left": freezenLeft + offLeft, "width": postil_width - (freezenLeft + offLeft - postil_left) });
$(e).show().find(".formulaInputFocus").css("margin-left", -(freezenLeft + offLeft - postil_left));
$(e).show().find(".arrowCanvas").hide();
}
} }
else{ else{
$(e).show().find(".luckysheet-postil-show-main").css({ "left": freezenLeft + offLeft, "width": postil_width - (freezenLeft + offLeft - postil_left) }); luckysheetPostil.buildPs(r, c, postil);
$(e).show().find(".formulaInputFocus").css("margin-left", -(freezenLeft + offLeft - postil_left));
$(e).show().find(".arrowCanvas").hide();
} }
} }
else{ }
luckysheetPostil.buildPs(r, c, postil); else{
} $(e).show().find(".luckysheet-postil-show-main").css("left", postil_left + offLeft);
$(e).show().find(".arrowCanvas").css("left", size[0] + offLeft);
} }
}) })
} }

16
src/controllers/handler.js

@ -187,6 +187,10 @@ export default function luckysheetHandler() {
let col_st = luckysheet_searcharray(visibledatacolumn_c, scrollLeft); let col_st = luckysheet_searcharray(visibledatacolumn_c, scrollLeft);
let row_st = luckysheet_searcharray(visibledatarow_c, scrollTop); let row_st = luckysheet_searcharray(visibledatarow_c, scrollTop);
if (luckysheetFreezen.freezenhorizontaldata != null) {
row_st = luckysheet_searcharray(visibledatarow_c, scrollTop + luckysheetFreezen.freezenhorizontaldata[0]);
}
let colscroll = 0; let colscroll = 0;
let rowscroll = 0; let rowscroll = 0;
@ -212,6 +216,10 @@ export default function luckysheetHandler() {
rowscroll = row_ed == 0 ? 0 : visibledatarow_c[row_ed - 1]; rowscroll = row_ed == 0 ? 0 : visibledatarow_c[row_ed - 1];
if (luckysheetFreezen.freezenhorizontaldata != null) {
rowscroll -= luckysheetFreezen.freezenhorizontaldata[0];
}
$("#luckysheet-scrollbar-y").scrollTop(rowscroll); $("#luckysheet-scrollbar-y").scrollTop(rowscroll);
} }
else if(event.deltaX != 0){ else if(event.deltaX != 0){
@ -1241,6 +1249,14 @@ export default function luckysheetHandler() {
let x = mouse[0] + scrollLeft; let x = mouse[0] + scrollLeft;
let y = mouse[1] + scrollTop; let y = mouse[1] + scrollTop;
if(luckysheetFreezen.freezenverticaldata != null && mouse[0] < (luckysheetFreezen.freezenverticaldata[0] - luckysheetFreezen.freezenverticaldata[2])){
x = mouse[0] + luckysheetFreezen.freezenverticaldata[2];
}
if(luckysheetFreezen.freezenhorizontaldata != null && mouse[1] < (luckysheetFreezen.freezenhorizontaldata[0] - luckysheetFreezen.freezenhorizontaldata[2])){
y = mouse[1] + luckysheetFreezen.freezenhorizontaldata[2];
}
let row_location = rowLocation(y), let row_location = rowLocation(y),
row_index = row_location[2]; row_index = row_location[2];

45
src/controllers/updateCell.js

@ -17,7 +17,6 @@ import {isInlineStringCell} from './inlineString';
import Store from '../store'; import Store from '../store';
export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocus) { export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocus) {
if(!checkProtectionLocked(row_index1, col_index1, Store.currentSheetIndex)){ if(!checkProtectionLocked(row_index1, col_index1, Store.currentSheetIndex)){
$("#luckysheet-functionbox-cell").blur(); $("#luckysheet-functionbox-cell").blur();
return; return;
@ -27,8 +26,6 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
return; return;
} }
//数据验证 //数据验证
if(dataVerificationCtrl.dataVerification != null && dataVerificationCtrl.dataVerification[row_index1 + '_' + col_index1] != null){ if(dataVerificationCtrl.dataVerification != null && dataVerificationCtrl.dataVerification[row_index1 + '_' + col_index1] != null){
let dataVerificationItem = dataVerificationCtrl.dataVerification[row_index1 + '_' + col_index1]; let dataVerificationItem = dataVerificationCtrl.dataVerification[row_index1 + '_' + col_index1];
@ -41,7 +38,12 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
} }
let size = getColumnAndRowSize(row_index1, col_index1, d); let size = getColumnAndRowSize(row_index1, col_index1, d);
let row = size.row, row_pre = size.row_pre, col = size.col, col_pre = size.col_pre, row_index = size.row_index, col_index = size.col_index; let row = size.row,
row_pre = size.row_pre,
col = size.col,
col_pre = size.col_pre,
row_index = size.row_index,
col_index = size.col_index;
if($("#luckysheet-dropCell-icon").is(":visible")){ if($("#luckysheet-dropCell-icon").is(":visible")){
$("#luckysheet-dropCell-icon").remove(); $("#luckysheet-dropCell-icon").remove();
@ -56,14 +58,24 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
return; return;
} }
let left = col_pre + container_offset.left + Store.rowHeaderWidth - scrollLeft - 2;
if(col_index1 <= luckysheetFreezen.freezenverticaldata[1]){
left = col_pre + container_offset.left + Store.rowHeaderWidth - 2;
}
let top = row_pre + container_offset.top + Store.infobarHeight + Store.toolbarHeight + Store.calculatebarHeight + Store.columeHeaderHeight - scrollTop - 2;
if(row_index1 <= luckysheetFreezen.freezenhorizontaldata[1]){
top = row_pre + container_offset.top + Store.infobarHeight + Store.toolbarHeight + Store.calculatebarHeight + Store.columeHeaderHeight - 2;
}
let input_postition = { let input_postition = {
"min-width": col - col_pre+ 1- 8, "min-width": col - col_pre+ 1- 8,
"min-height": row - row_pre + 1- 4, "min-height": row - row_pre + 1- 4,
"max-width":winW + scrollLeft - col_pre - 20 - Store.rowHeaderWidth, "max-width": winW + scrollLeft - col_pre - 20 - Store.rowHeaderWidth,
"max-height": winH + scrollTop - row_pre - 20 - 15 - Store.toolbarHeight - Store.infobarHeight - Store.calculatebarHeight - Store.sheetBarHeight - Store.statisticBarHeight, "max-height": winH + scrollTop - row_pre - 20 - 15 - Store.toolbarHeight - Store.infobarHeight - Store.calculatebarHeight - Store.sheetBarHeight - Store.statisticBarHeight,
"left": col_pre + container_offset.left + Store.rowHeaderWidth - scrollLeft - 2, "left": left,
"top": row_pre + container_offset.top + Store.infobarHeight + Store.toolbarHeight + Store.calculatebarHeight + Store.columeHeaderHeight - scrollTop - 2, "top": top,
} }
let inputContentScale = { let inputContentScale = {
@ -193,8 +205,6 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
if(input_postition["min-width"] > input_postition["max-width"]){ if(input_postition["min-width"] > input_postition["max-width"]){
input_postition["min-width"] = input_postition["max-width"]; input_postition["min-width"] = input_postition["max-width"];
} }
if((value == null || value.toString() == "") && !cover){ if((value == null || value.toString() == "") && !cover){
value = "<br/>"; value = "<br/>";
@ -242,7 +252,6 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
cleargridelement(); cleargridelement();
} }
export function setCenterInputPosition(row_index, col_index, d){ export function setCenterInputPosition(row_index, col_index, d){
if(row_index==null ||col_index==null){ if(row_index==null ||col_index==null){
return; return;
@ -294,9 +303,11 @@ export function getColumnAndRowSize(row_index, col_index, d){
row_pre = row_index - 1 == -1 ? 0 : Store.visibledatarow[row_index - 1]; row_pre = row_index - 1 == -1 ? 0 : Store.visibledatarow[row_index - 1];
let col = Store.visibledatacolumn[col_index], let col = Store.visibledatacolumn[col_index],
col_pre = col_index - 1 == -1 ? 0 : Store.visibledatacolumn[col_index - 1]; col_pre = col_index - 1 == -1 ? 0 : Store.visibledatacolumn[col_index - 1];
if(d==null){
if(d == null){
d = Store.flowdata; d = Store.flowdata;
} }
let margeset = menuButton.mergeborer(d, row_index, col_index); let margeset = menuButton.mergeborer(d, row_index, col_index);
if(!!margeset){ if(!!margeset){
row = margeset.row[1]; row = margeset.row[1];
@ -308,11 +319,11 @@ export function getColumnAndRowSize(row_index, col_index, d){
} }
return { return {
row:row, row: row,
row_pre:row_pre, row_pre: row_pre,
row_index:row_index, row_index: row_index,
col:col, col: col,
col_pre:col_pre, col_pre: col_pre,
col_index:col_index col_index: col_index
} }
} }

Loading…
Cancel
Save