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

Поправил выделение после doubleClick-а в редакторе ячейки.

ToDo реализовать для слова.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@67680 954022d7-b5bf-4e40-9824-e11837661b57
parent 1486094d
...@@ -260,6 +260,13 @@ var c_oAscCellEditorState = { ...@@ -260,6 +260,13 @@ var c_oAscCellEditorState = {
editFormula: 4 // Редактирование формулы editFormula: 4 // Редактирование формулы
}; };
// Состояние select-а
var c_oAscCellEditorSelectState = {
no : 0,
char : 1,
word : 2
};
// Пересчитывать ли ширину столбца // Пересчитывать ли ширину столбца
var c_oAscCanChangeColWidth = { var c_oAscCanChangeColWidth = {
none: 0, // not recalc none: 0, // not recalc
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
this.undoAllMode = false; this.undoAllMode = false;
this.selectionBegin = -1; this.selectionBegin = -1;
this.selectionEnd = -1; this.selectionEnd = -1;
this.isSelectMode = false; this.isSelectMode = c_oAscCellEditorSelectState.no;
this.hasCursor = false; this.hasCursor = false;
this.hasFocus = false; this.hasFocus = false;
this.newTextFormat = undefined; this.newTextFormat = undefined;
...@@ -746,7 +746,7 @@ ...@@ -746,7 +746,7 @@
this.topLineIndex = 0; this.topLineIndex = 0;
this.selectionBegin = -1; this.selectionBegin = -1;
this.selectionEnd = -1; this.selectionEnd = -1;
this.isSelectMode = false; this.isSelectMode = c_oAscCellEditorSelectState.no;
this.hasCursor = false; this.hasCursor = false;
this.undoList = []; this.undoList = [];
...@@ -1698,11 +1698,15 @@ ...@@ -1698,11 +1698,15 @@
var t = this; var t = this;
function doChangeSelection(coord) { function doChangeSelection(coord) {
// ToDo реализовать для слова.
if (c_oAscCellEditorSelectState.word === t.isSelectMode) {
return;
}
var pos = t._findCursorPosition(coord); var pos = t._findCursorPosition(coord);
if (pos !== undefined) { if (pos !== undefined) {
pos >= 0 ? t._selectChars(kPosition, pos) : t._selectChars(pos); pos >= 0 ? t._selectChars(kPosition, pos) : t._selectChars(pos);
} }
if (t.isSelectMode && !window['IS_NATIVE_EDITOR']) { if (c_oAscCellEditorSelectState.no !== t.isSelectMode && !window['IS_NATIVE_EDITOR']) {
t.selectionTimer = window.setTimeout(function() { t.selectionTimer = window.setTimeout(function() {
doChangeSelection(coord); doChangeSelection(coord);
}, t.defaults.selectionTimeout); }, t.defaults.selectionTimeout);
...@@ -2445,7 +2449,7 @@ ...@@ -2445,7 +2449,7 @@
/** @param event {MouseEvent} */ /** @param event {MouseEvent} */
CellEditor.prototype._onWindowMouseUp = function(event) { CellEditor.prototype._onWindowMouseUp = function(event) {
this.isSelectMode = false; this.isSelectMode = c_oAscCellEditorSelectState.no;
if (this.callTopLineMouseup) { if (this.callTopLineMouseup) {
this._topLineMouseUp(); this._topLineMouseUp();
} }
...@@ -2454,7 +2458,7 @@ ...@@ -2454,7 +2458,7 @@
/** @param event {MouseEvent} */ /** @param event {MouseEvent} */
CellEditor.prototype._onWindowMouseMove = function(event) { CellEditor.prototype._onWindowMouseMove = function(event) {
if (this.isSelectMode && !this.hasCursor) { if (c_oAscCellEditorSelectState.no !== this.isSelectMode && !this.hasCursor) {
this._changeSelection(this._getCoordinates(event)); this._changeSelection(this._getCoordinates(event));
} }
return true; return true;
...@@ -2472,8 +2476,8 @@ ...@@ -2472,8 +2476,8 @@
this.input.isFocused = false; this.input.isFocused = false;
if (0 === event.button) { if (0 === event.button) {
this.isSelectMode = true;
if (1 === this.clickCounter.getClickCount() % 2) { if (1 === this.clickCounter.getClickCount() % 2) {
this.isSelectMode = c_oAscCellEditorSelectState.char;
if (!event.shiftKey) { if (!event.shiftKey) {
this._showCursor(); this._showCursor();
pos = this._findCursorPosition(coord); pos = this._findCursorPosition(coord);
...@@ -2485,6 +2489,7 @@ ...@@ -2485,6 +2489,7 @@
} }
} else { } else {
// Dbl click // Dbl click
this.isSelectMode = c_oAscCellEditorSelectState.word;
// Окончание слова // Окончание слова
var endWord = this.textRender.getNextWord(this.cursorPos); var endWord = this.textRender.getNextWord(this.cursorPos);
// Начало слова (ищем по окончанию, т.к. могли попасть в пробел) // Начало слова (ищем по окончанию, т.к. могли попасть в пробел)
...@@ -2503,7 +2508,7 @@ ...@@ -2503,7 +2508,7 @@
this.handlers.trigger('onContextMenu', event); this.handlers.trigger('onContextMenu', event);
return true; return true;
} }
this.isSelectMode = false; this.isSelectMode = c_oAscCellEditorSelectState.no;
return true; return true;
}; };
...@@ -2512,7 +2517,7 @@ ...@@ -2512,7 +2517,7 @@
var coord = this._getCoordinates(event); var coord = this._getCoordinates(event);
this.clickCounter.mouseMoveEvent(coord.x, coord.y); this.clickCounter.mouseMoveEvent(coord.x, coord.y);
this.hasCursor = true; this.hasCursor = true;
if (this.isSelectMode) { if (c_oAscCellEditorSelectState.no !== this.isSelectMode) {
this._changeSelection(coord); this._changeSelection(coord);
} }
return true; return true;
......
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