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 show2 = true;
if(postil_top + postil_height < freezenTop){
$(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){
if(postil_top + postil_height <= freezenTop + offTop){
show = false;
if(r >= _this.freezenhorizontaldata[1]){
if(postil_top + postil_height < freezenTop){
$(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){
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{
$(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;
$(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);
}
}
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{
if(postil_left < freezenLeft + offLeft){
if(postil_left + postil_width <= freezenLeft + offLeft){
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();
$(e).show().find(".luckysheet-postil-show-main").css("top", postil_top + offTop);
$(e).show().find(".arrowCanvas").css("top", size[1] + offTop);
}
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{
$(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);
if(postil_left < freezenLeft + offLeft){
if(postil_left + postil_width <= freezenLeft + offLeft){
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;
}
}
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){
$(e).hide();
@ -1281,24 +1293,30 @@ const luckysheetFreezen = {
let size = luckysheetPostil.getArrowCanvasSize(postil_left, postil_top, toX, toY);
if(postil_top + postil_height < freezenTop){
$(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){
if(postil_top + postil_height <= freezenTop + offTop){
$(e).hide();
if(r >= _this.freezenhorizontaldata[1]){
if(postil_top + postil_height < freezenTop){
$(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){
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{
$(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();
luckysheetPostil.buildPs(r, c, postil);
}
}
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);
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{
if(postil_left < freezenLeft + offLeft){
if(postil_left + postil_width <= freezenLeft + offLeft){
$(e).hide();
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{
if(postil_left < freezenLeft + offLeft){
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{
$(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();
luckysheetPostil.buildPs(r, c, postil);
}
}
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 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 rowscroll = 0;
@ -212,6 +216,10 @@ export default function luckysheetHandler() {
rowscroll = row_ed == 0 ? 0 : visibledatarow_c[row_ed - 1];
if (luckysheetFreezen.freezenhorizontaldata != null) {
rowscroll -= luckysheetFreezen.freezenhorizontaldata[0];
}
$("#luckysheet-scrollbar-y").scrollTop(rowscroll);
}
else if(event.deltaX != 0){
@ -1241,6 +1249,14 @@ export default function luckysheetHandler() {
let x = mouse[0] + scrollLeft;
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),
row_index = row_location[2];

45
src/controllers/updateCell.js

@ -17,7 +17,6 @@ import {isInlineStringCell} from './inlineString';
import Store from '../store';
export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocus) {
if(!checkProtectionLocked(row_index1, col_index1, Store.currentSheetIndex)){
$("#luckysheet-functionbox-cell").blur();
return;
@ -27,8 +26,6 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
return;
}
//数据验证
if(dataVerificationCtrl.dataVerification != null && dataVerificationCtrl.dataVerification[row_index1 + '_' + col_index1] != null){
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 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")){
$("#luckysheet-dropCell-icon").remove();
@ -56,14 +58,24 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
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 = {
"min-width": col - col_pre+ 1- 8,
"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,
"left": col_pre + container_offset.left + Store.rowHeaderWidth - scrollLeft - 2,
"top": row_pre + container_offset.top + Store.infobarHeight + Store.toolbarHeight + Store.calculatebarHeight + Store.columeHeaderHeight - scrollTop - 2,
"left": left,
"top": top,
}
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"]){
input_postition["min-width"] = input_postition["max-width"];
}
if((value == null || value.toString() == "") && !cover){
value = "<br/>";
@ -242,7 +252,6 @@ export function luckysheetupdateCell(row_index1, col_index1, d, cover, isnotfocu
cleargridelement();
}
export function setCenterInputPosition(row_index, col_index, d){
if(row_index==null ||col_index==null){
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];
let col = Store.visibledatacolumn[col_index],
col_pre = col_index - 1 == -1 ? 0 : Store.visibledatacolumn[col_index - 1];
if(d==null){
if(d == null){
d = Store.flowdata;
}
let margeset = menuButton.mergeborer(d, row_index, col_index);
if(!!margeset){
row = margeset.row[1];
@ -308,11 +319,11 @@ export function getColumnAndRowSize(row_index, col_index, d){
}
return {
row:row,
row_pre:row_pre,
row_index:row_index,
col:col,
col_pre:col_pre,
col_index:col_index
row: row,
row_pre: row_pre,
row_index: row_index,
col: col,
col_pre: col_pre,
col_index: col_index
}
}

Loading…
Cancel
Save