Skip to content

Commit

Permalink
Refactoring cursors
Browse files Browse the repository at this point in the history
  • Loading branch information
K0R0L committed May 29, 2023
1 parent 34a0063 commit 135ae6e
Show file tree
Hide file tree
Showing 77 changed files with 108 additions and 95 deletions.
10 changes: 5 additions & 5 deletions cell/model/DrawingObjects/DrawingDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ function CDrawingDocument()
{
this.IsLockObjectsEnable = false;

AscCommon.g_oHtmlCursor.register("de-markerformat", "marker_format", "14 8", "pointer");
AscCommon.g_oHtmlCursor.register("select-table-row", "select_row", "10 5", "default");
AscCommon.g_oHtmlCursor.register("select-table-column", "select_column", "5 10", "default");
AscCommon.g_oHtmlCursor.register("select-table-content", "select_table", "10 10", "default");
AscCommon.g_oHtmlCursor.register("de-tableeraser", "eraser", "8 19", "pointer");
AscCommon.g_oHtmlCursor.register(AscCommon.Cursors.MarkerFormat, "14 8", "pointer");
AscCommon.g_oHtmlCursor.register(AscCommon.Cursors.SelectTableRow, "10 5", "default");
AscCommon.g_oHtmlCursor.register(AscCommon.Cursors.SelectTableColumn, "5 10", "default");
AscCommon.g_oHtmlCursor.register(AscCommon.Cursors.SelectTableContent, "10 10", "default");
AscCommon.g_oHtmlCursor.register(AscCommon.Cursors.TableEraser, "8 19", "pointer");

this.m_oWordControl = null;
this.m_oLogicDocument = null;
Expand Down
1 change: 0 additions & 1 deletion cell/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3551,7 +3551,6 @@
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
window['AscCommonExcel'].g_ActiveCell = null; // Active Cell for calculate (in R1C1 mode for relative cell)
window['AscCommonExcel'].g_R1C1Mode = false; // No calculate in R1C1 mode
window['AscCommonExcel'].kCurCells = "se-cells";
window["AscCommonExcel"].recalcType = recalcType;
window["AscCommonExcel"].sizePxinPt = sizePxinPt;
window['AscCommonExcel'].c_sPerDay = c_sPerDay;
Expand Down
2 changes: 1 addition & 1 deletion cell/view/CellEditorView.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@
};

CellEditor.prototype.updateWizardMode = function (mode) {
this._updateCursorStyle(mode ? AscCommonExcel.kCurCells : this.defaults.cursorShape);
this._updateCursorStyle(mode ? AscCommon.Cursors.CellCur : this.defaults.cursorShape);
};

CellEditor.prototype.move = function () {
Expand Down
4 changes: 2 additions & 2 deletions cell/view/WorkbookView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@
var arrClose = [];
arrClose.push(new asc_CMM({type: c_oAscMouseMoveType.None}));
t.handlers.trigger("asc_onMouseMove", arrClose);
t._onUpdateCursor(AscCommonExcel.kCurCells);
t._onUpdateCursor(AscCommon.Cursors.CellCur);
t.timerId = null;
t.timerEnd = true;
}, 1000);
Expand Down Expand Up @@ -1565,7 +1565,7 @@
hyperlink: ct.hyperlink
}));
} else {
ct.cursor = AscCommonExcel.kCurCells;
ct.cursor = AscCommon.Cursors.CellCur;
}
}

Expand Down
34 changes: 14 additions & 20 deletions cell/view/WorksheetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@
*/
var kCurDefault = "default";
var kCurCorner = "pointer";
var kCurColSelect = "select-table-column";
var kCurColResize = "move-border-horizontally";
var kCurRowSelect = "select-table-row";
var kCurRowResize = "move-border-vertically";
// Курсор для автозаполнения
var kCurFillHandle = "crosshair";
// Курсор для гиперссылки
Expand All @@ -132,12 +128,10 @@
var kCurEWResize = "ew-resize";
var kCurNSResize = "ns-resize";


var kCurFormatPainterExcel = "se-formatpainter";
AscCommon.g_oHtmlCursor.register(AscCommonExcel.kCurCells, "plus", "6 6", "cell");
AscCommon.g_oHtmlCursor.register(kCurFormatPainterExcel, "plus_copy", "6 12", "pointer");
AscCommon.g_oHtmlCursor.register("move-border-vertically", "move_border_vertically", "9 9", "default");
AscCommon.g_oHtmlCursor.register("move-border-horizontally", "move_border_horizontally", "9 9", "default");
AscCommon.g_oHtmlCursor.register(AscCommon.Cursors.CellCur, "6 6", "cell");
AscCommon.g_oHtmlCursor.register(AscCommon.Cursors.CellFormatPainter, "6 12", "pointer");
AscCommon.g_oHtmlCursor.register(AscCommon.Cursors.MoveBorderVer, "9 9", "default");
AscCommon.g_oHtmlCursor.register(AscCommon.Cursors.MoveBorderHor, "9 9", "default");

var kNewLine = "\n";

Expand Down Expand Up @@ -8747,17 +8741,17 @@
if (onCol && onRow) {
res = true;
type = c_oAscChangeSelectionFormatTable.data;
cursor = "select-table-content";
cursor = AscCommon.Cursors.SelectTableContent;
break;
} else if (onCol) {
res = true;
type = c_oAscChangeSelectionFormatTable.dataColumn;
cursor = "select-table-column";
cursor = AscCommon.Cursors.SelectTableColumn;
break;
} else if (onRow) {
res = true;
type = c_oAscChangeSelectionFormatTable.row;
cursor = "select-table-row";
cursor = AscCommon.Cursors.SelectTableRow;
break;
}
}
Expand Down Expand Up @@ -8787,7 +8781,7 @@
var t = this;

if(this.workbook.Api.isEyedropperStarted()) {
return {cursor: AscCommon.kCurEyedropper, target: c_oTargetType.Cells, color: this.workbook.Api.getEyedropperColor(x, y)};
return {cursor: AscCommon.Cursors.Eyedropper, target: c_oTargetType.Cells, color: this.workbook.Api.getEyedropperColor(x, y)};
}
const oPlaceholderCursor = this.objectRender.checkCursorPlaceholder(x, y);
if (oPlaceholderCursor) {
Expand All @@ -8800,7 +8794,7 @@
return (null === (res = this._hitCursorSelectionVisibleArea(_vr, x, y, _offsetX, _offsetY)));
});
if (res) return res;
return {cursor: AscCommonExcel.kCurCells, target: c_oTargetType.Cells, col: -1, row: -1};
return {cursor: AscCommon.Cursors.CellCur, target: c_oTargetType.Cells, col: -1, row: -1};
} else {
return oResDefault;
}
Expand Down Expand Up @@ -8953,7 +8947,7 @@
readyMode && !this.model.getSheetProtection(Asc.c_oAscSheetProtectType.formatRows);
// ToDo В Excel зависимость epsilon от размера ячейки (у нас фиксированный 3)
return {
cursor: f ? kCurRowResize : kCurRowSelect,
cursor: f ? AscCommon.Cursors.MoveBorderVer : AscCommon.Cursors.SelectTableRow,
target: f ? c_oTargetType.RowResize : c_oTargetType.RowHeader,
col: -1,
row: r.row + (isNotFirst && f && y < r.top + 3 ? -1 : 0),
Expand All @@ -8971,7 +8965,7 @@
readyMode && !this.model.getSheetProtection(Asc.c_oAscSheetProtectType.formatColumns);
// ToDo В Excel зависимость epsilon от размера ячейки (у нас фиксированный 3)
return {
cursor: f ? kCurColResize : kCurColSelect,
cursor: f ? AscCommon.Cursors.MoveBorderHor : AscCommon.Cursors.SelectTableColumn,
target: f ? c_oTargetType.ColumnResize : c_oTargetType.ColumnHeader,
col: c.col + (isNotFirst && f && x < c.left + 3 ? -1 : 0),
row: -1,
Expand All @@ -8995,9 +8989,9 @@
}
}
let oData = this.workbook.Api.getFormatPainterData();
let sCursor = kCurFormatPainterExcel;
let sCursor = AscCommon.Cursors.CellFormatPainter;
if(oData && oData.isDrawingData()) {
sCursor = AscCommon.kCurFormatPainterDrawing;
sCursor = AscCommon.Cursors.ShapeCopy;
}
return {cursor: sCursor, target: target, col: col, row: row};
}
Expand Down Expand Up @@ -9197,7 +9191,7 @@
// Проверим, может мы в гиперлинке
oHyperlink = readyMode && this.model.getHyperlinkByCell(r.row, c.col);
cellCursor = {
cursor: AscCommonExcel.kCurCells,
cursor: AscCommon.Cursors.CellCur,
target: c_oTargetType.Cells,
col: (c ? c.col : -1),
row: (r ? r.row : -1),
Expand Down
2 changes: 1 addition & 1 deletion common/Charts/DrawingObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -4338,7 +4338,7 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
if(objectInfo) {
let oData = oApi.getFormatPainterData();
if(oData && oData.isDrawingData()) {
objectInfo.cursor = AscCommon.kCurFormatPainterDrawing;
objectInfo.cursor = AscCommon.Cursors.ShapeCopy;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions common/Drawings/States.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,11 @@ NullState.prototype =
{
if(oPainterData.isDrawingData())
{
sType = AscCommon.kCurFormatPainterDrawing;
sType = AscCommon.Cursors.ShapeCopy;
}
else
{
sType = AscCommon.kCurFormatPainterWord;
sType = AscCommon.Cursors.TextCopy;
}
}
return {cursorType: sType, objectId: "1"};
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
Loading

0 comments on commit 135ae6e

Please sign in to comment.