Commit e3e74f5f authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Перевел CellEditor на prototype

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55778 954022d7-b5bf-4e40-9824-e11837661b57
parent 560eb437
......@@ -161,11 +161,7 @@
return this;
}
CellEditor.prototype = {
constructor: CellEditor,
_init: function (settings) {
CellEditor.prototype._init = function (settings) {
var t = this;
var z = t.defaults.canvasZIndex;
......@@ -222,10 +218,10 @@
this.fKeyUp = function () {return t._onWindowKeyUp.apply(t, arguments);};
this.fKeyMouseUp = function () {return t._onWindowMouseUp.apply(t, arguments);};
this.fKeyMouseMove = function () {return t._onWindowMouseMove.apply(t, arguments);};
},
};
destroy: function() {
},
CellEditor.prototype.destroy = function() {
};
/**
* @param {Object} options
......@@ -241,7 +237,7 @@
* textColor
* saveValueCallback
*/
open: function (options) {
CellEditor.prototype.open = function (options) {
var t = this;
t.isOpened = true;
if (window.addEventListener) {
......@@ -269,9 +265,9 @@
t.setFocus(t.isTopLineActive ? true : (undefined !== options.focus) ? options.focus : t._haveTextInEdit() ? true : false);
t._updateFormulaEditMod(/*bIsOpen*/true);
t._updateUndoRedoChanged();
},
};
close: function (saveValue) {
CellEditor.prototype.close = function (saveValue) {
var t = this, opt = t.options, ret = false;
if (saveValue && "function" === typeof opt.saveValueCallback) {
......@@ -300,9 +296,9 @@
t.handlers.trigger("closed");
return true;
},
};
setTextStyle: function (prop, val) {
CellEditor.prototype.setTextStyle = function (prop, val) {
var t = this, opt = t.options, begin, end, i, first, last;
if (t.selectionBegin !== t.selectionEnd) {
......@@ -353,58 +349,58 @@
}
}
},
};
empty: function(options) {
CellEditor.prototype.empty = function(options) {
// Чистка для редактирования только All
if (c_oAscCleanOptions.All !== options)
return;
// Удаляем только selection
this._removeChars();
},
};
undo: function () {
CellEditor.prototype.undo = function () {
this._performAction(this.undoList, this.redoList);
},
};
undoAll: function () {
CellEditor.prototype.undoAll = function () {
this.undoAllMode = true;
while (this.undoList.length > 0) {
this.undo();
}
this.undoAllMode = false;
this._update();
},
};
redo: function () {
CellEditor.prototype.redo = function () {
this._performAction(this.redoList, this.undoList);
},
};
getZoom: function () {
CellEditor.prototype.getZoom = function () {
return this.drawingCtx.getZoom();
},
};
changeZoom: function (factor) {
CellEditor.prototype.changeZoom = function (factor) {
this.drawingCtx.changeZoom(factor);
this.overlayCtx.changeZoom(factor);
},
};
canEnterCellRange: function () {
CellEditor.prototype.canEnterCellRange = function () {
var isRange = this._findRangeUnderCursor().range !== null;
var prevChar = this.textRender.getChars(this.cursorPos-1, 1);
return isRange || this.rangeChars.indexOf(prevChar) >= 0;
},
};
activateCellRange: function () {
CellEditor.prototype.activateCellRange = function () {
var res = this._findRangeUnderCursor();
res.range ?
this.handlers.trigger("existedRange", res.range) :
this.handlers.trigger("newRange");
},
};
enterCellRange: function (rangeStr) {
CellEditor.prototype.enterCellRange = function (rangeStr) {
var t = this;
var res = t._findRangeUnderCursor();
......@@ -421,17 +417,17 @@
}
t._addChars(rangeStr, undefined, /*isRange*/true);
},
};
changeCellRange: function(range,rangeStr){
CellEditor.prototype.changeCellRange = function(range,rangeStr){
var t = this;
t._moveCursor(kPosition, range.cursorePos/* -length */);
t._selectChars(kPositionLength, range.formulaRangeLength);
t._addChars(rangeStr, undefined, /*isRange*/true);
t._moveCursor(kEndOfText);
},
};
move: function (dx, dy) {
CellEditor.prototype.move = function (dx, dy) {
var t = this;
var opt = t.options;
......@@ -448,20 +444,20 @@
t._adjustCanvas();
t._renderText();
t._drawSelection();
},
};
setFocus: function (hasFocus) {
CellEditor.prototype.setFocus = function (hasFocus) {
this.hasFocus = !!hasFocus;
this.handlers.trigger("gotFocus", this.hasFocus);
},
};
restoreFocus: function () {
CellEditor.prototype.restoreFocus = function () {
if (this.isTopLineActive) {
this.input.focus();
}
},
};
copySelection: function () {
CellEditor.prototype.copySelection = function () {
var t = this;
var res = null;
if(t.selectionBegin !== t.selectionEnd)
......@@ -477,9 +473,9 @@
res = t._getFragments(start, end - start);
}
return res;
},
};
cutSelection: function () {
CellEditor.prototype.cutSelection = function () {
var t = this;
var f = null;
if (t.selectionBegin !== t.selectionEnd) {
......@@ -495,9 +491,9 @@
t._removeChars();
}
return f;
},
};
pasteText: function (text) {
CellEditor.prototype.pasteText = function (text) {
var t = this;
text = text.replace(/\t/g," ");
text = text.replace(/\r/g, "");
......@@ -538,9 +534,9 @@
t._wrapText();
t._update();
}
},
};
paste: function (fragments, cursorPos) {
CellEditor.prototype.paste = function (fragments, cursorPos) {
var t = this;
var wrap = fragments.some(function(val){return val.text.indexOf("\n")>=0;});
......@@ -564,19 +560,19 @@
// Сделано только для вставки формулы в ячейку (когда не открыт редактор)
if (undefined !== cursorPos)
t._moveCursor(kPosition, cursorPos);
},
};
/** @param flag {Boolean} */
enableKeyEventsHandler: function (flag) {
CellEditor.prototype.enableKeyEventsHandler = function (flag) {
this.enableKeyEvents = !!flag;
},
};
isFormula: function() {
CellEditor.prototype.isFormula = function() {
var fragments = this.options.fragments;
return fragments.length > 0 && fragments[0].text.length > 0 && fragments[0].text.charAt(0) === "=";
},
};
insertFormula: function (functionName) {
CellEditor.prototype.insertFormula = function (functionName) {
// Проверим форула ли это
if (false === this.isFormula()) {
// Может это просто текста нет
......@@ -600,22 +596,22 @@
this._addChars (functionName);
// Меняем позицию курсора внутрь скобок
this._moveCursor (kPosition, this.cursorPos - 1);
},
};
replaceText: function (pos, len, newText) {
CellEditor.prototype.replaceText = function (pos, len, newText) {
this._moveCursor(kPosition, pos);
this._selectChars(kPosition, pos + len);
this._addChars(newText);
},
};
setFontRenderingMode: function () {
CellEditor.prototype.setFontRenderingMode = function () {
if (this.isOpened)
this._draw();
},
};
// Private
_setOptions: function (options) {
CellEditor.prototype._setOptions = function (options) {
function cmpNum(a, b) {return a - b;}
function cmpNumRev(a, b) {return b - a;}
......@@ -666,9 +662,9 @@
t.redoList = [];
t.undoMode = false;
t.skipKeyPress = false;
},
};
_parseRangeStr: function (s) {
CellEditor.prototype._parseRangeStr = function (s) {
var p, range, ca1, ca2;
p = s.replace(/\$/g, "").split(":");
......@@ -695,9 +691,9 @@
range.startCol = range.c1;
range.startRow = range.r1;
return range;
},
};
_parseFormulaRanges: function () {
CellEditor.prototype._parseFormulaRanges = function () {
var s = this._getFragmentsText(this.options.fragments);
// в Chrome 23 есть баг в RegExp с флагом "g" - не обнуляется lastIndex
......@@ -732,9 +728,9 @@
}
}
return ret;
},
};
_findRangeUnderCursor: function () {
CellEditor.prototype._findRangeUnderCursor = function () {
var t = this;
var s = t.textRender.getChars(0, t.textRender.getCharsCount());
var re = new RegExp("^" + this.reRangeStr, "i");
......@@ -770,9 +766,9 @@
return !range ?
{index: -1, length: 0, range: null} :
{index: beg + res.index + 1, length: res[1].length, range: range};
},
};
_updateFormulaEditMod: function (bIsOpen) {
CellEditor.prototype._updateFormulaEditMod = function (bIsOpen) {
var isFormula = this.isFormula();
if (!bIsOpen)
this._updateEditorState(isFormula);
......@@ -780,19 +776,19 @@
var ret1 = this._parseFormulaRanges();
var ret2 = this.canEnterCellRange();
this.handlers.trigger("updateFormulaEditModEnd", ret1 || ret2);
},
};
// Обновляем состояние Undo/Redo
_updateUndoRedoChanged: function () {
CellEditor.prototype._updateUndoRedoChanged = function () {
this.handlers.trigger("updateUndoRedoChanged", 0 < this.undoList.length, 0 < this.redoList.length);
},
};
_haveTextInEdit: function () {
CellEditor.prototype._haveTextInEdit = function () {
var fragments = this.options.fragments;
return fragments.length > 0 && fragments[0].text.length > 0;
},
};
_updateEditorState: function (isFormula) {
CellEditor.prototype._updateEditorState = function (isFormula) {
if (undefined === isFormula)
isFormula = this.isFormula();
var editorState = isFormula ? c_oAscCellEditorState.editFormula :
......@@ -803,11 +799,11 @@
this.m_nEditorState = editorState;
this.handlers.trigger("updateEditorState", this.m_nEditorState);
}
},
};
// Rendering
_draw: function () {
CellEditor.prototype._draw = function () {
var t = this, opt = t.options, canExpW = true, canExpH = true, tm, expW, expH;
if (opt.fragments.length > 0) {
......@@ -837,9 +833,9 @@
t.input.value = t._getFragmentsText(opt.fragments);
t._updateCursorPosition();
t._showCursor();
},
};
_update: function () {
CellEditor.prototype._update = function () {
var t = this, opt = t.options, tm, canExpW, canExpH, oldLC, doAjust = false;
if (opt.fragments.length > 0) {
......@@ -880,9 +876,9 @@
t._updateFormulaEditMod(/*bIsOpen*/false);
t._updateUndoRedoChanged();
},
};
_fireUpdated: function () {
CellEditor.prototype._fireUpdated = function () {
var t = this;
var s = t._getFragmentsText(t.options.fragments);
var isFormula = s.charAt(0) === "=";
......@@ -906,9 +902,9 @@
}
t.handlers.trigger("updated", s, t.cursorPos, isFormula, funcPos, funcName);
},
};
_expandWidth: function () {
CellEditor.prototype._expandWidth = function () {
var t = this, opt = t.options, l = false, r = false;
function expandLeftSide() {
......@@ -944,9 +940,9 @@
default:r = expandRightSide();
}
return l || r;
},
};
_expandHeight: function () {
CellEditor.prototype._expandHeight = function () {
var t = this, opt = t.options, i = asc_search(opt.bottomSide, function (v) {return v > t.bottom;});
if (i >= 0) {
t.bottom = opt.bottomSide[i];
......@@ -957,13 +953,13 @@
t.bottom = val;
}
return false;
},
};
_cleanText: function () {
CellEditor.prototype._cleanText = function () {
this.drawingCtx.clear();
},
};
_adjustCanvas: function () {
CellEditor.prototype._adjustCanvas = function () {
var t = this;
var z = t.defaults.canvasZIndex;
......@@ -978,9 +974,9 @@
// show
t.canvasOuterStyle.display = "block";
},
};
_renderText: function (dy) {
CellEditor.prototype._renderText = function (dy) {
var t = this, opt = t.options, ctx = t.drawingCtx;
ctx.setFillStyle(opt.background)
......@@ -989,13 +985,13 @@
if (opt.fragments.length > 0) {
t.textRender.render(t._getContentLeft(), -ctx._1px_y + (dy === undefined ? 0 : dy), t._getContentWidth(), opt.textColor);
}
},
};
_cleanSelection: function () {
CellEditor.prototype._cleanSelection = function () {
this.overlayCtx.clear();
},
};
_drawSelection: function () {
CellEditor.prototype._drawSelection = function () {
var ctx = this.overlayCtx, ppix = ctx.getPPIX(), ppiy = ctx.getPPIY();
var begPos, endPos, top, top1, top2, begInfo, endInfo, line1, line2, i;
......@@ -1030,17 +1026,17 @@
}
}
}
},
};
// Cursor
showCursor: function () {
CellEditor.prototype.showCursor = function () {
if (!this.options) {this.options = {};}
this.options.isHideCursor = false;
this._showCursor();
},
};
_showCursor: function () {
CellEditor.prototype._showCursor = function () {
var t = this;
if (true === t.options.isHideCursor || t.isTopLineActive === true) {return;}
window.clearInterval(t.cursorTID);
......@@ -1048,15 +1044,15 @@
t.cursorTID = window.setInterval(function () {
t.cursorStyle.display = ("none" === t.cursorStyle.display) ? "block" : "none";
}, t.defaults.blinkInterval);
},
};
_hideCursor: function () {
CellEditor.prototype._hideCursor = function () {
var t = this;
window.clearInterval(t.cursorTID);
t.cursorStyle.display = "none";
},
};
_updateCursorPosition: function (redrawText) {
CellEditor.prototype._updateCursorPosition = function (redrawText) {
var t = this;
var h = t.canvas.height;
var y = - t.textRender.calcLineOffset(t.topLineIndex);
......@@ -1094,9 +1090,9 @@
if (cur) {t.input.scrollTop = t.input.clientHeight * cur.lineIndex;}
if (t.isTopLineActive && !t.skipTLUpdate) {t._updateTopLineCurPos();}
},
};
_moveCursor: function (kind, pos) {
CellEditor.prototype._moveCursor = function (kind, pos) {
var t = this;
switch (kind) {
case kPrevChar: t.cursorPos = t.textRender.getPrevChar(t.cursorPos); break;
......@@ -1119,9 +1115,9 @@
}
t._updateCursorPosition();
t._showCursor();
},
};
_findCursorPosition: function (coord) {
CellEditor.prototype._findCursorPosition = function (coord) {
var t = this;
var lc = t.textRender.getLinesCount();
var i, h, w, li, chw;
......@@ -1140,17 +1136,17 @@
}
}
return kNextLine;
},
};
_updateTopLineCurPos: function () {
CellEditor.prototype._updateTopLineCurPos = function () {
var t = this;
var isSelected = t.selectionBegin !== t.selectionEnd;
var b = isSelected ? t.selectionBegin : t.cursorPos;
var e = isSelected ? t.selectionEnd : t.cursorPos;
if (t.input.setSelectionRange) {t.input.setSelectionRange(Math.min(b, e), Math.max(b, e));}
},
};
_topLineGotFocus: function () {
CellEditor.prototype._topLineGotFocus = function () {
var t = this;
t.isTopLineActive = true;
t.input.isFocused = true;
......@@ -1158,9 +1154,9 @@
t._hideCursor();
t._updateTopLineCurPos();
t._cleanSelection();
},
};
_topLineMouseUp: function () {
CellEditor.prototype._topLineMouseUp = function () {
var t = this;
this.callTopLineMouseup = false;
// при такой комбинации ctrl+a, click, ctrl+a, click не обновляется selectionStart
......@@ -1173,9 +1169,9 @@
if (b !== e) {t._selectChars(kPosition, e);}
}
});
},
};
_syncEditors: function () {
CellEditor.prototype._syncEditors = function () {
var t = this;
var s1 = t._getFragmentsText(t.options.fragments);
var s2 = t.input.value;
......@@ -1188,25 +1184,25 @@
else while (i2 < l && s1.charAt(i1) !== s2.charAt(i2)) {++i2;}
t._addChars(s2.slice(i1, i2), i1);
},
};
// Content
_getContentLeft: function () {
CellEditor.prototype._getContentLeft = function () {
return asc_calcnpt(0, this.drawingCtx.getPPIX(), this.defaults.padding/*px*/);
},
};
_getContentWidth: function () {
CellEditor.prototype._getContentWidth = function () {
return this.right - this.left - asc_calcnpt(0, this.drawingCtx.getPPIX(),
this.defaults.padding + this.defaults.padding + 1/*px*/);
},
};
_getContentHeight: function () {
CellEditor.prototype._getContentHeight = function () {
var t = this;
return t.bottom - t.top;
},
};
_getContentPosition: function () {
CellEditor.prototype._getContentPosition = function () {
var ppix = this.drawingCtx.getPPIX();
switch (this.textFlags.textAlign) {
......@@ -1216,9 +1212,9 @@
return asc_calcnpt(0.5 * (this.right - this.left), ppix, 0);
}
return asc_calcnpt(0, ppix, this.defaults.padding);
},
};
_wrapFragments: function (frag) {
CellEditor.prototype._wrapFragments = function (frag) {
var i, s, ret = false;
for (i = 0; i < frag.length; ++i) {
s = frag[i].text;
......@@ -1229,15 +1225,15 @@
frag[i].text = s;
}
return ret;
},
};
_wrapText: function () {
CellEditor.prototype._wrapText = function () {
var t = this;
t.textFlags.wrapOnlyNL = true;
t._wrapFragments(t.options.fragments);
},
};
_addChars: function (str, pos, isRange) {
CellEditor.prototype._addChars = function (str, pos, isRange) {
var t = this, opt = t.options, f, l, s;
if (t.selectionBegin !== t.selectionEnd) {t._removeChars(undefined, undefined, isRange);}
......@@ -1267,14 +1263,14 @@
if (!t.undoAllMode) {
t._update();
}
},
};
_addNewLine: function () {
CellEditor.prototype._addNewLine = function () {
this._wrapText();
this._addChars(kNewLine);
},
};
_removeChars: function (pos, length, isRange) {
CellEditor.prototype._removeChars = function (pos, length, isRange) {
var t = this, opt = t.options, b, e, l, first, last;
if (t.selectionBegin !== t.selectionEnd) {
......@@ -1332,9 +1328,9 @@
if (!t.undoAllMode) {
t._update();
}
},
};
_selectChars: function (kind, pos) {
CellEditor.prototype._selectChars = function (kind, pos) {
var t = this;
var begPos, endPos;
......@@ -1346,9 +1342,9 @@
t.selectionEnd = endPos;
t._drawSelection();
if (t.isTopLineActive && !t.skipTLUpdate) {t._updateTopLineCurPos();}
},
};
_changeSelection: function (coord) {
CellEditor.prototype._changeSelection = function (coord) {
var t = this;
function doChangeSelection(coord) {
......@@ -1363,9 +1359,9 @@
window.clearTimeout(t.selectionTimer);
t.selectionTimer = window.setTimeout(function () {doChangeSelection(coord);}, 0);
},
};
_findFragment: function (pos) {
CellEditor.prototype._findFragment = function (pos) {
var opt = this.options, i, begin, end;
for (i = 0, begin = 0; i < opt.fragments.length; ++i) {
......@@ -1378,9 +1374,9 @@
}
}
return pos === end ? {index: i-1, begin: begin, end: end} : undefined;
},
};
_findFragmentToInsertInto: function (pos) {
CellEditor.prototype._findFragmentToInsertInto = function (pos) {
var opt = this.options, i, begin, end;
for (i = 0, begin = 0; i < opt.fragments.length; ++i) {
......@@ -1393,14 +1389,14 @@
}
}
return undefined;
},
};
_isWholeFragment: function (pos, len) {
CellEditor.prototype._isWholeFragment = function (pos, len) {
var fr = this._findFragment(pos);
return fr && pos === fr.begin && len === fr.end - fr.begin;
},
};
_splitFragment: function (f, pos) {
CellEditor.prototype._splitFragment = function (f, pos) {
var t = this, opt = t.options, fr;
if (pos > f.begin && pos < f.end) {
......@@ -1411,9 +1407,9 @@
new Fragment({format: fr.format.clone(), text: fr.text.slice(0, pos - f.begin)}),
new Fragment({format: fr.format.clone(), text: fr.text.slice(pos - f.begin)})]));
}
},
};
_getFragments: function (startPos, length) {
CellEditor.prototype._getFragments = function (startPos, length) {
var t = this, opt = t.options, endPos = startPos + length - 1, res = [], fr, i;
var first = t._findFragment(startPos);
var last = t._findFragment(endPos);
......@@ -1438,9 +1434,9 @@
}
return res;
},
};
_extractFragments: function(startPos, length) {
CellEditor.prototype._extractFragments = function(startPos, length) {
var t = this, fr;
fr = t._findFragment(startPos);
......@@ -1450,9 +1446,9 @@
fr = t._findFragment(startPos + length);
if (!fr) {throw "Can not extract fragment of text";}
t._splitFragment(fr, startPos + length);
},
};
_addFragments: function (f, pos) {
CellEditor.prototype._addFragments = function (f, pos) {
var t = this, opt = t.options, fr;
fr = t._findFragment(pos);
......@@ -1471,9 +1467,9 @@
if (!t.undoAllMode) {
t._update();
}
},
};
_mergeFragments: function () {
CellEditor.prototype._mergeFragments = function () {
var t = this, opt = t.options, i;
for (i = 0; i < opt.fragments.length; ) {
......@@ -1492,9 +1488,9 @@
}
++i;
}
},
};
_cleanFragments: function (fr) {
CellEditor.prototype._cleanFragments = function (fr) {
var t = this, i, s, f, wrap = t.textFlags.wrapText || t.textFlags.wrapOnlyNL;
for (i = 0; i < fr.length; ++i) {
......@@ -1506,17 +1502,17 @@
if (f.fn === "") {f.fn = t.options.font.FontFamily.Name;}
if (f.fs === 0) {f.fs = t.options.font.FontSize;}
}
},
};
_getFragmentsLength: function (f) {
CellEditor.prototype._getFragmentsLength = function (f) {
return f.length > 0 ? f.reduce(function(pv, cv){return pv + cv.text.length;}, 0) : 0;
},
};
_getFragmentsText: function (f) {
CellEditor.prototype._getFragmentsText = function (f) {
return f.length > 0 ? f.reduce(function(pv, cv){return pv + cv.text;}, "") : "";
},
};
_setFormatProperty: function (format, prop, val) {
CellEditor.prototype._setFormatProperty = function (format, prop, val) {
switch (prop) {
case "fn": format.fn = val; format.scheme = Asc.EFontScheme.fontschemeNone; break;
case "fs": format.fs = val; break;
......@@ -1547,9 +1543,9 @@
break;
}
return val;
},
};
_performAction: function (list1, list2) {
CellEditor.prototype._performAction = function (list1, list2) {
var t = this, action, str, pos, len;
if (list1.length < 1) {return;}
......@@ -1579,14 +1575,14 @@
t.undoMode = true;
action.fn.apply(t, action.args);
t.undoMode = false;
},
};
_tryCloseEditor: function (event) {
CellEditor.prototype._tryCloseEditor = function (event) {
if (this.close(true))
this.handlers.trigger("applyCloseEvent", event);
},
};
_getAutoComplete: function(str) {
CellEditor.prototype._getAutoComplete = function(str) {
// ToDo можно ускорить делая поиск каждый раз не в большом массиве, а в уменьшенном (по предыдущим символам)
var oLastResult = this.objAutoComplete[str];
if (oLastResult)
......@@ -1600,9 +1596,9 @@
arrResult.push(arrAutoComplete[i]);
}
return this.objAutoComplete[str] = arrResult;
},
};
_updateFormulaSelectorPosition: function() {
CellEditor.prototype._updateFormulaSelectorPosition = function() {
var selector = document.getElementById("formulaSelector");
if ( selector ) {
var api = asc["editor"];
......@@ -1638,12 +1634,12 @@
}
}
}
},
};
// Event handlers
/** @param event {jQuery.Event} */
_onWindowKeyDown: function (event) {
CellEditor.prototype._onWindowKeyDown = function (event) {
var t = this, kind = undefined, hieroglyph = false;
if (!t.isOpened || !t.enableKeyEvents) {return true;}
......@@ -1873,10 +1869,10 @@
t.skipKeyPress = false;
t.skipTLUpdate = true;
return true;
},
};
/** @param event {jQuery.Event} */
_onWindowKeyPress: function (event) {
CellEditor.prototype._onWindowKeyPress = function (event) {
var t = this;
if (!t.isOpened || !t.enableKeyEvents) {return true;}
......@@ -1917,33 +1913,33 @@
}
return t.isTopLineActive ? true : false; // prevent event bubbling
},
};
/** @param event {jQuery.Event} */
_onWindowKeyUp: function (event) {
CellEditor.prototype._onWindowKeyUp = function (event) {
var t = this;
// для исправления Bug 15902 - Alt забирает фокус из приложения
if (t.lastKeyCode === 18 && event.which === 18) {
return false;
}
},
};
/** @param event {jQuery.Event} */
_onWindowMouseUp: function (event) {
CellEditor.prototype._onWindowMouseUp = function (event) {
this.isSelectMode = false;
if (this.callTopLineMouseup) {this._topLineMouseUp();}
return true;
},
};
/** @param event {jQuery.Event} */
_onWindowMouseMove: function (event) {
CellEditor.prototype._onWindowMouseMove = function (event) {
if (this.isSelectMode && !this.hasCursor) {this._changeSelection(this._getCoordinates(event));}
return true;
},
};
/** @param event {jQuery.Event} */
_onMouseDown: function (event) {
CellEditor.prototype._onMouseDown = function (event) {
var t = this;
var coord = t._getCoordinates(event);
var pos;
......@@ -1964,31 +1960,31 @@
}
}
return true;
},
};
/** @param event {jQuery.Event} */
_onMouseUp: function (event) {
CellEditor.prototype._onMouseUp = function (event) {
this.isSelectMode = false;
return true;
},
};
/** @param event {jQuery.Event} */
_onMouseMove: function (event) {
CellEditor.prototype._onMouseMove = function (event) {
this.hasCursor = true;
if (this.isSelectMode) {
this._changeSelection(this._getCoordinates(event));
}
return true;
},
};
/** @param event {jQuery.Event} */
_onMouseLeave: function (event) {
CellEditor.prototype._onMouseLeave = function (event) {
this.hasCursor = false;
return true;
},
};
/** @param event {jQuery.Event} */
_onMouseDblClick: function (event) {
CellEditor.prototype._onMouseDblClick = function (event) {
var t = this;
// Окончание слова
var endWord = t.textRender.getNextWord(t.cursorPos);
......@@ -2002,10 +1998,10 @@
t._moveCursor(kPosition, startWord);
t._selectChars(kPosition, endWord);
return true;
},
};
/** @param event {jQuery.Event} */
_onInputTextArea: function (event) {
CellEditor.prototype._onInputTextArea = function (event) {
if (this.handlers.trigger("isViewerMode"))
return true;
......@@ -2016,17 +2012,15 @@
}
this.isUpdateValue = true;
return true;
},
};
/** @param event {jQuery.Event} */
_getCoordinates: function (event) {
CellEditor.prototype._getCoordinates = function (event) {
var t = this;
var offs = $(t.canvasOverlay).offset();
var x = (event.pageX - offs.left) / t.kx;
var y = (event.pageY - offs.top) / t.ky;
return {x: x, y: y};
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment