|
@@ -42,7 +42,8 @@ import { getSheetIndex, getRangetxt } from '../methods/get';
|
|
|
import {
|
|
|
rowLocation,
|
|
|
colLocation,
|
|
|
- mouseposition
|
|
|
+ mouseposition,
|
|
|
+ position,
|
|
|
} from '../global/location';
|
|
|
import { rowlenByRange } from '../global/getRowlen';
|
|
|
import { isRealNull, hasPartMC, isEditMode, checkIsAllowEdit } from '../global/validate';
|
|
@@ -1138,7 +1139,7 @@ export default function luckysheetHandler() {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (isEditMode()) { //非编辑模式下禁止右键功能框
|
|
|
+ if (!isEditMode()) { //非编辑模式下禁止右键功能框
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -1481,50 +1482,84 @@ export default function luckysheetHandler() {
|
|
|
handleCellDragStopEvent(e);
|
|
|
}, false);
|
|
|
document.getElementById('luckysheet-cell-main').addEventListener('dragover', function(e){
|
|
|
- e.preventDefault();
|
|
|
- e.stopPropagation();
|
|
|
+ let ret = handleCellDragOverEvent(e);
|
|
|
+ if(ret){
|
|
|
+ e.preventDefault();
|
|
|
+ e.stopPropagation();
|
|
|
+ }
|
|
|
}, false);
|
|
|
|
|
|
+ function handleCellDragOverEvent(event) {
|
|
|
+ if (luckysheetConfigsetting && luckysheetConfigsetting.hook && luckysheetConfigsetting.hook.cellDragOver) {
|
|
|
+ let pos = position(event.pageX, event.pageY);
|
|
|
+
|
|
|
+ let margeset = menuButton.mergeborer(Store.flowdata, pos.row_index, pos.col_index);
|
|
|
+ if (!!margeset) {
|
|
|
+ pos.row = margeset.row[1];
|
|
|
+ pos.row_pre = margeset.row[0];
|
|
|
+ pos.row_index = margeset.row[2];
|
|
|
+
|
|
|
+ pos.col = margeset.column[1];
|
|
|
+ pos.col_pre = margeset.column[0];
|
|
|
+ pos.col_index = margeset.column[2];
|
|
|
+ }
|
|
|
+
|
|
|
+ let sheetFile = sheetmanage.getSheetByIndex();
|
|
|
+
|
|
|
+ let luckysheetTableContent = $("#luckysheetTableContent").get(0).getContext("2d");
|
|
|
+ return method.createHookFunction("cellDragOver", Store.flowdata[pos.row_index][pos.col_index], {
|
|
|
+ r:pos.row_index,
|
|
|
+ c:pos.col_index,
|
|
|
+ "start_r": pos.row_pre,
|
|
|
+ "start_c": pos.col_pre,
|
|
|
+ "end_r": pos.row,
|
|
|
+ "end_c": pos.col,
|
|
|
+ ox: pos.ox,
|
|
|
+ oy: pos.oy,
|
|
|
+ mx: pos.mx,
|
|
|
+ my: pos.my,
|
|
|
+ or: pos.row_index_ox,
|
|
|
+ oc: pos.col_index_oy,
|
|
|
+ }, sheetFile, luckysheetTableContent, event);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 处理单元格上鼠标拖拽停止事件
|
|
|
* @param {DragEvent} event
|
|
|
*/
|
|
|
function handleCellDragStopEvent(event) {
|
|
|
if (luckysheetConfigsetting && luckysheetConfigsetting.hook && luckysheetConfigsetting.hook.cellDragStop) {
|
|
|
- let mouse = mouseposition(event.pageX, event.pageY);
|
|
|
- let x = mouse[0] + $("#luckysheet-cell-main").scrollLeft();
|
|
|
- let y = mouse[1] + $("#luckysheet-cell-main").scrollTop();
|
|
|
-
|
|
|
- let row_location = rowLocation(y),
|
|
|
- row = row_location[1],
|
|
|
- row_pre = row_location[0],
|
|
|
- row_index = row_location[2];
|
|
|
- let col_location = colLocation(x),
|
|
|
- col = col_location[1],
|
|
|
- col_pre = col_location[0],
|
|
|
- col_index = col_location[2];
|
|
|
-
|
|
|
- let margeset = menuButton.mergeborer(Store.flowdata, row_index, col_index);
|
|
|
- if (!!margeset) {
|
|
|
- row = margeset.row[1];
|
|
|
- row_pre = margeset.row[0];
|
|
|
- row_index = margeset.row[2];
|
|
|
-
|
|
|
- col = margeset.column[1];
|
|
|
- col_pre = margeset.column[0];
|
|
|
- col_index = margeset.column[2];
|
|
|
- }
|
|
|
-
|
|
|
+ let pos = position(event.pageX, event.pageY);
|
|
|
+
|
|
|
+ let margeset = menuButton.mergeborer(Store.flowdata, pos.row_index, pos.col_index);
|
|
|
+ if (!!margeset) {
|
|
|
+ pos.row = margeset.row[1];
|
|
|
+ pos.row_pre = margeset.row[0];
|
|
|
+ pos.row_index = margeset.row[2];
|
|
|
+
|
|
|
+ pos.col = margeset.column[1];
|
|
|
+ pos.col_pre = margeset.column[0];
|
|
|
+ pos.col_index = margeset.column[2];
|
|
|
+ }
|
|
|
+
|
|
|
let sheetFile = sheetmanage.getSheetByIndex();
|
|
|
|
|
|
let luckysheetTableContent = $("#luckysheetTableContent").get(0).getContext("2d");
|
|
|
- method.createHookFunction("cellDragStop", Store.flowdata[row_index][col_index], {
|
|
|
- r: row_index,
|
|
|
- c: col_index,
|
|
|
- "start_r": row_pre,
|
|
|
- "start_c": col_pre,
|
|
|
- "end_r": row,
|
|
|
- "end_c": col
|
|
|
+ method.createHookFunction("cellDragStop", Store.flowdata[pos.row_index][pos.col_index], {
|
|
|
+ r:pos.row_index,
|
|
|
+ c:pos.col_index,
|
|
|
+ "start_r": pos.row_pre,
|
|
|
+ "start_c": pos.col_pre,
|
|
|
+ "end_r": pos.row,
|
|
|
+ "end_c": pos.col,
|
|
|
+ ox: pos.ox,
|
|
|
+ oy: pos.oy,
|
|
|
+ mx: pos.mx,
|
|
|
+ my: pos.my,
|
|
|
+ or: pos.row_index_ox,
|
|
|
+ oc: pos.col_index_oy,
|
|
|
}, sheetFile, luckysheetTableContent, event);
|
|
|
}
|
|
|
}
|
|
@@ -1537,32 +1572,21 @@ export default function luckysheetHandler() {
|
|
|
window.cancelAnimationFrame(Store.jfautoscrollTimeout);
|
|
|
|
|
|
if(luckysheetConfigsetting && luckysheetConfigsetting.hook && luckysheetConfigsetting.hook.sheetMousemove){
|
|
|
- let mouse = mouseposition(event.pageX, event.pageY);
|
|
|
- let x = mouse[0] + $("#luckysheet-cell-main").scrollLeft();
|
|
|
- let y = mouse[1] + $("#luckysheet-cell-main").scrollTop();
|
|
|
-
|
|
|
- let row_location = rowLocation(y),
|
|
|
- row = row_location[1],
|
|
|
- row_pre = row_location[0],
|
|
|
- row_index = row_location[2];
|
|
|
- let col_location = colLocation(x),
|
|
|
- col = col_location[1],
|
|
|
- col_pre = col_location[0],
|
|
|
- col_index = col_location[2];
|
|
|
-
|
|
|
- let margeset = menuButton.mergeborer(Store.flowdata, row_index, col_index);
|
|
|
+ let pos = position(event.pageX, event.pageY);
|
|
|
+
|
|
|
+ let margeset = menuButton.mergeborer(Store.flowdata, pos.row_index, pos.col_index);
|
|
|
if (!!margeset) {
|
|
|
- row = margeset.row[1];
|
|
|
- row_pre = margeset.row[0];
|
|
|
- row_index = margeset.row[2];
|
|
|
+ pos.row = margeset.row[1];
|
|
|
+ pos.row_pre = margeset.row[0];
|
|
|
+ pos.row_index = margeset.row[2];
|
|
|
|
|
|
- col = margeset.column[1];
|
|
|
- col_pre = margeset.column[0];
|
|
|
- col_index = margeset.column[2];
|
|
|
+ pos.col = margeset.column[1];
|
|
|
+ pos.col_pre = margeset.column[0];
|
|
|
+ pos.col_index = margeset.column[2];
|
|
|
}
|
|
|
|
|
|
|
|
|
- // if(Store.flowdata[row_index] && Store.flowdata[row_index][col_index]){
|
|
|
+ // if(Store.flowdata[pos.row_index] && Store.flowdata[pos.row_index][pos.col_index]){
|
|
|
let sheetFile = sheetmanage.getSheetByIndex();
|
|
|
|
|
|
let moveState = {
|
|
@@ -1587,14 +1611,20 @@ export default function luckysheetHandler() {
|
|
|
|
|
|
let luckysheetTableContent = $("#luckysheetTableContent").get(0).getContext("2d");
|
|
|
|
|
|
- if(Store.flowdata && Store.flowdata[row_index]){
|
|
|
- method.createHookFunction("sheetMousemove", Store.flowdata[row_index][col_index], {
|
|
|
- r:row_index,
|
|
|
- c:col_index,
|
|
|
- "start_r": row_pre,
|
|
|
- "start_c": col_pre,
|
|
|
- "end_r": row,
|
|
|
- "end_c": col
|
|
|
+ if(Store.flowdata && Store.flowdata[pos.row_index]){
|
|
|
+ method.createHookFunction("sheetMousemove", Store.flowdata[pos.row_index][pos.col_index], {
|
|
|
+ r:pos.row_index,
|
|
|
+ c:pos.col_index,
|
|
|
+ "start_r": pos.row_pre,
|
|
|
+ "start_c": pos.col_pre,
|
|
|
+ "end_r": pos.row,
|
|
|
+ "end_c": pos.col,
|
|
|
+ ox: pos.ox,
|
|
|
+ oy: pos.oy,
|
|
|
+ mx: pos.mx,
|
|
|
+ my: pos.my,
|
|
|
+ or: pos.row_index_ox,
|
|
|
+ oc: pos.col_index_oy,
|
|
|
}, sheetFile,moveState,luckysheetTableContent);
|
|
|
}
|
|
|
// }
|
|
@@ -2416,14 +2446,14 @@ export default function luckysheetHandler() {
|
|
|
let mouse = mouseposition(event.pageX, event.pageY);
|
|
|
let scrollTop = $("#luckysheet-rows-h").scrollTop();
|
|
|
let y = mouse[1] + scrollTop;
|
|
|
- let winH = $(window).height();
|
|
|
+ let winH = $("#luckysheet-cell-main").height();
|
|
|
|
|
|
let row_location = rowLocation(y),
|
|
|
row = row_location[1],
|
|
|
row_pre = row_location[0],
|
|
|
row_index = row_location[2];
|
|
|
|
|
|
- if ((y + 3) - Store.luckysheet_rows_change_size_start[0] > 19 && y < winH + scrollTop - 200) {
|
|
|
+ if ((y + 3) - Store.luckysheet_rows_change_size_start[0] > 19 && y < winH + scrollTop) {
|
|
|
$("#luckysheet-change-size-line").css({ "top": y });
|
|
|
$("#luckysheet-rows-change-size").css({ "top": y });
|
|
|
}
|
|
@@ -3634,23 +3664,23 @@ export default function luckysheetHandler() {
|
|
|
let mouse = mouseposition(event.pageX, event.pageY);
|
|
|
let scrollTop = $("#luckysheet-rows-h").scrollTop();
|
|
|
let y = mouse[1] + scrollTop;
|
|
|
- let winH = $(window).height();
|
|
|
+ let winH = $("#luckysheet-cell-main").height();
|
|
|
|
|
|
let row_location = rowLocation(y),
|
|
|
row = row_location[1],
|
|
|
row_pre = row_location[0],
|
|
|
row_index = row_location[2];
|
|
|
|
|
|
+ if (y >= winH + scrollTop) {
|
|
|
+ y = winH + scrollTop;
|
|
|
+ }
|
|
|
+
|
|
|
let size = (y + 3) - Store.luckysheet_rows_change_size_start[0];
|
|
|
-
|
|
|
- if ((y + 3) - Store.luckysheet_rows_change_size_start[0] < 19) {
|
|
|
+
|
|
|
+ if (size < 19) {
|
|
|
size = 19;
|
|
|
}
|
|
|
|
|
|
- if (y >= winH - 200 + scrollTop) {
|
|
|
- size = winH - 200 - Store.luckysheet_rows_change_size_start[0] + scrollTop;
|
|
|
- }
|
|
|
-
|
|
|
let cfg = $.extend(true, {}, Store.config);
|
|
|
if (cfg["rowlen"] == null) {
|
|
|
cfg["rowlen"] = {};
|