Commit 7156771d authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Правка бага http://bugzserver/show_bug.cgi?id=24021

На mac не обрабатывался metaKey в эвенте.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55895 954022d7-b5bf-4e40-9824-e11837661b57
parent f48d9b27
...@@ -4908,7 +4908,7 @@ function DrawingObjects() { ...@@ -4908,7 +4908,7 @@ function DrawingObjects() {
_this.graphicObjectKeyPress = function(e) { _this.graphicObjectKeyPress = function(e) {
e.KeyCode = e.keyCode; e.KeyCode = e.keyCode;
e.CtrlKey = e.ctrlKey; e.CtrlKey = e.metaKey || e.ctrlKey;
e.AltKey = e.altKey; e.AltKey = e.altKey;
e.ShiftKey = e.shiftKey; e.ShiftKey = e.shiftKey;
e.Which = e.which; e.Which = e.which;
......
...@@ -2746,6 +2746,8 @@ DrawingObjectsController.prototype = ...@@ -2746,6 +2746,8 @@ DrawingObjectsController.prototype =
onKeyDown: function(e) onKeyDown: function(e)
{ {
// TODO!!! var ctrlKey = e.metaKey || e.ctrlKey
var drawingObjectsController = this; var drawingObjectsController = this;
var bRetValue = false; var bRetValue = false;
var state = drawingObjectsController.curState; var state = drawingObjectsController.curState;
......
...@@ -1638,9 +1638,10 @@ ...@@ -1638,9 +1638,10 @@
// Event handlers // Event handlers
/** @param event {jQuery.Event} */ /** @param event {KeyboardEvent} */
CellEditor.prototype._onWindowKeyDown = function (event) { CellEditor.prototype._onWindowKeyDown = function (event) {
var t = this, kind = undefined, hieroglyph = false; var t = this, kind = undefined, hieroglyph = false;
var ctrlKey = event.metaKey || event.ctrlKey;
if (!t.isOpened || !t.enableKeyEvents) {return true;} if (!t.isOpened || !t.enableKeyEvents) {return true;}
...@@ -1688,27 +1689,27 @@ ...@@ -1688,27 +1689,27 @@
case 8: // "backspace" case 8: // "backspace"
if (hieroglyph) {t._syncEditors();} if (hieroglyph) {t._syncEditors();}
t._removeChars(event.ctrlKey ? kPrevWord : kPrevChar); t._removeChars(ctrlKey ? kPrevWord : kPrevChar);
return false; return false;
case 46: // "del" case 46: // "del"
if (!t.hasFocus) {t.setFocus(true);} if (!t.hasFocus) {t.setFocus(true);}
if (hieroglyph) {t._syncEditors();} if (hieroglyph) {t._syncEditors();}
t.skipTLUpdate = true; t.skipTLUpdate = true;
t._removeChars(event.ctrlKey ? kNextWord : kNextChar); t._removeChars(ctrlKey ? kNextWord : kNextChar);
return true; return true;
case 37: // "left" case 37: // "left"
if (!t.hasFocus) {break;} if (!t.hasFocus) {break;}
if (hieroglyph) {t._syncEditors();} if (hieroglyph) {t._syncEditors();}
kind = event.ctrlKey ? kPrevWord : kPrevChar; kind = ctrlKey ? kPrevWord : kPrevChar;
event.shiftKey ? t._selectChars(kind) : t._moveCursor(kind); event.shiftKey ? t._selectChars(kind) : t._moveCursor(kind);
return false; return false;
case 39: // "right" case 39: // "right"
if (!t.hasFocus) {break;} if (!t.hasFocus) {break;}
if (hieroglyph) {t._syncEditors();} if (hieroglyph) {t._syncEditors();}
kind = event.ctrlKey ? kNextWord : kNextChar; kind = ctrlKey ? kNextWord : kNextChar;
event.shiftKey ? t._selectChars(kind) : t._moveCursor(kind); event.shiftKey ? t._selectChars(kind) : t._moveCursor(kind);
return false; return false;
...@@ -1727,19 +1728,19 @@ ...@@ -1727,19 +1728,19 @@
case 35: // "end" case 35: // "end"
if (!t.hasFocus) {break;} if (!t.hasFocus) {break;}
if (hieroglyph) {t._syncEditors();} if (hieroglyph) {t._syncEditors();}
kind = event.ctrlKey ? kEndOfText : kEndOfLine; kind = ctrlKey ? kEndOfText : kEndOfLine;
event.shiftKey ? t._selectChars(kind) : t._moveCursor(kind); event.shiftKey ? t._selectChars(kind) : t._moveCursor(kind);
return false; return false;
case 36: // "home" case 36: // "home"
if (!t.hasFocus) {break;} if (!t.hasFocus) {break;}
if (hieroglyph) {t._syncEditors();} if (hieroglyph) {t._syncEditors();}
kind = event.ctrlKey ? kBeginOfText : kBeginOfLine; kind = ctrlKey ? kBeginOfText : kBeginOfLine;
event.shiftKey ? t._selectChars(kind) : t._moveCursor(kind); event.shiftKey ? t._selectChars(kind) : t._moveCursor(kind);
return false; return false;
case 53: // 5 case 53: // 5
if (event.ctrlKey) { if (ctrlKey) {
if (!t.hasFocus) {t.setFocus(true);} if (!t.hasFocus) {t.setFocus(true);}
// Отключим стандартную обработку браузера нажатия ctlr + 5 // Отключим стандартную обработку браузера нажатия ctlr + 5
event.stopPropagation(); event.stopPropagation();
...@@ -1751,7 +1752,7 @@ ...@@ -1751,7 +1752,7 @@
break; break;
case 65: // A case 65: // A
if (event.ctrlKey) { if (ctrlKey) {
if (!t.hasFocus) {t.setFocus(true);} if (!t.hasFocus) {t.setFocus(true);}
// Отключим стандартную обработку браузера нажатия ctlr + a // Отключим стандартную обработку браузера нажатия ctlr + a
if (!t.isTopLineActive) { if (!t.isTopLineActive) {
...@@ -1765,7 +1766,7 @@ ...@@ -1765,7 +1766,7 @@
break; break;
case 66: // B case 66: // B
if (event.ctrlKey) { if (ctrlKey) {
if (!t.hasFocus) {t.setFocus(true);} if (!t.hasFocus) {t.setFocus(true);}
// Отключим стандартную обработку браузера нажатия ctlr + b // Отключим стандартную обработку браузера нажатия ctlr + b
event.stopPropagation(); event.stopPropagation();
...@@ -1777,7 +1778,7 @@ ...@@ -1777,7 +1778,7 @@
break; break;
case 73: // I case 73: // I
if (event.ctrlKey) { if (ctrlKey) {
if (!t.hasFocus) {t.setFocus(true);} if (!t.hasFocus) {t.setFocus(true);}
// Отключим стандартную обработку браузера нажатия ctlr + i // Отключим стандартную обработку браузера нажатия ctlr + i
event.stopPropagation(); event.stopPropagation();
...@@ -1789,7 +1790,7 @@ ...@@ -1789,7 +1790,7 @@
break; break;
/*case 83: // S /*case 83: // S
if (event.ctrlKey) { if (ctrlKey) {
if (!t.hasFocus) {t.setFocus(true);} if (!t.hasFocus) {t.setFocus(true);}
if (hieroglyph) {t._syncEditors();} if (hieroglyph) {t._syncEditors();}
...@@ -1800,7 +1801,7 @@ ...@@ -1800,7 +1801,7 @@
break;*/ break;*/
case 85: // U case 85: // U
if (event.ctrlKey) { if (ctrlKey) {
if (!t.hasFocus) {t.setFocus(true);} if (!t.hasFocus) {t.setFocus(true);}
// Отключим стандартную обработку браузера нажатия ctlr + u // Отключим стандартную обработку браузера нажатия ctlr + u
event.stopPropagation(); event.stopPropagation();
...@@ -1820,7 +1821,7 @@ ...@@ -1820,7 +1821,7 @@
return false; return false;
case 80: // print Ctrl + p case 80: // print Ctrl + p
if (event.ctrlKey) { if (ctrlKey) {
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
return false; return false;
...@@ -1830,7 +1831,7 @@ ...@@ -1830,7 +1831,7 @@
case 67: // copy Ctrl + c case 67: // copy Ctrl + c
case 86: // paste Ctrl + v case 86: // paste Ctrl + v
case 88: // redo Ctrl + x case 88: // redo Ctrl + x
if (event.ctrlKey) { if (ctrlKey) {
if (!t.hasFocus) {t.setFocus(true);} if (!t.hasFocus) {t.setFocus(true);}
// возвращение фокуса в top line // возвращение фокуса в top line
if (t.isTopLineActive) { if (t.isTopLineActive) {
...@@ -1850,7 +1851,7 @@ ...@@ -1850,7 +1851,7 @@
case 89: // ctrl + y case 89: // ctrl + y
case 90: // ctrl + z case 90: // ctrl + z
if (event.ctrlKey) { if (ctrlKey) {
if (!t.hasFocus) {t.setFocus(true);} if (!t.hasFocus) {t.setFocus(true);}
event.which === 90 ? t.undo() : t.redo(); event.which === 90 ? t.undo() : t.redo();
return false; return false;
...@@ -1871,13 +1872,14 @@ ...@@ -1871,13 +1872,14 @@
return true; return true;
}; };
/** @param event {jQuery.Event} */ /** @param event {KeyboardEvent} */
CellEditor.prototype._onWindowKeyPress = function (event) { CellEditor.prototype._onWindowKeyPress = function (event) {
var t = this; var t = this;
var ctrlKey = event.metaKey || event.ctrlKey;
if (!t.isOpened || !t.enableKeyEvents) {return true;} if (!t.isOpened || !t.enableKeyEvents) {return true;}
if (t.skipKeyPress || event.which < 32 || event.altKey || event.ctrlKey) { if (t.skipKeyPress || event.which < 32 || event.altKey || ctrlKey) {
t.skipKeyPress = true; t.skipKeyPress = true;
return true; return true;
} }
...@@ -1915,7 +1917,7 @@ ...@@ -1915,7 +1917,7 @@
return t.isTopLineActive ? true : false; // prevent event bubbling return t.isTopLineActive ? true : false; // prevent event bubbling
}; };
/** @param event {jQuery.Event} */ /** @param event {KeyboardEvent} */
CellEditor.prototype._onWindowKeyUp = function (event) { CellEditor.prototype._onWindowKeyUp = function (event) {
var t = this; var t = this;
...@@ -1925,20 +1927,20 @@ ...@@ -1925,20 +1927,20 @@
} }
}; };
/** @param event {jQuery.Event} */ /** @param event {MouseEvent} */
CellEditor.prototype._onWindowMouseUp = function (event) { CellEditor.prototype._onWindowMouseUp = function (event) {
this.isSelectMode = false; this.isSelectMode = false;
if (this.callTopLineMouseup) {this._topLineMouseUp();} if (this.callTopLineMouseup) {this._topLineMouseUp();}
return true; return true;
}; };
/** @param event {jQuery.Event} */ /** @param event {MouseEvent} */
CellEditor.prototype._onWindowMouseMove = function (event) { CellEditor.prototype._onWindowMouseMove = function (event) {
if (this.isSelectMode && !this.hasCursor) {this._changeSelection(this._getCoordinates(event));} if (this.isSelectMode && !this.hasCursor) {this._changeSelection(this._getCoordinates(event));}
return true; return true;
}; };
/** @param event {jQuery.Event} */ /** @param event {MouseEvent} */
CellEditor.prototype._onMouseDown = function (event) { CellEditor.prototype._onMouseDown = function (event) {
var t = this; var t = this;
var coord = t._getCoordinates(event); var coord = t._getCoordinates(event);
...@@ -1962,13 +1964,13 @@ ...@@ -1962,13 +1964,13 @@
return true; return true;
}; };
/** @param event {jQuery.Event} */ /** @param event {MouseEvent} */
CellEditor.prototype._onMouseUp = function (event) { CellEditor.prototype._onMouseUp = function (event) {
this.isSelectMode = false; this.isSelectMode = false;
return true; return true;
}; };
/** @param event {jQuery.Event} */ /** @param event {MouseEvent} */
CellEditor.prototype._onMouseMove = function (event) { CellEditor.prototype._onMouseMove = function (event) {
this.hasCursor = true; this.hasCursor = true;
if (this.isSelectMode) { if (this.isSelectMode) {
...@@ -1977,13 +1979,13 @@ ...@@ -1977,13 +1979,13 @@
return true; return true;
}; };
/** @param event {jQuery.Event} */ /** @param event {MouseEvent} */
CellEditor.prototype._onMouseLeave = function (event) { CellEditor.prototype._onMouseLeave = function (event) {
this.hasCursor = false; this.hasCursor = false;
return true; return true;
}; };
/** @param event {jQuery.Event} */ /** @param event {MouseEvent} */
CellEditor.prototype._onMouseDblClick = function (event) { CellEditor.prototype._onMouseDblClick = function (event) {
var t = this; var t = this;
// Окончание слова // Окончание слова
...@@ -2014,7 +2016,7 @@ ...@@ -2014,7 +2016,7 @@
return true; return true;
}; };
/** @param event {jQuery.Event} */ /** @param event {MouseEvent} */
CellEditor.prototype._getCoordinates = function (event) { CellEditor.prototype._getCoordinates = function (event) {
var t = this; var t = this;
var offs = $(t.canvasOverlay).offset(); var offs = $(t.canvasOverlay).offset();
......
...@@ -246,7 +246,7 @@ DrawingObjectsController.prototype.checkSelectedObjectsAndFireCallback = functio ...@@ -246,7 +246,7 @@ DrawingObjectsController.prototype.checkSelectedObjectsAndFireCallback = functio
DrawingObjectsController.prototype.onMouseDown = function(e, x, y) DrawingObjectsController.prototype.onMouseDown = function(e, x, y)
{ {
e.ShiftKey = e.shiftKey; e.ShiftKey = e.shiftKey;
e.CtrlKey = e.ctrlKey; e.CtrlKey = e.metaKey || e.ctrlKey;
return this.curState.onMouseDown(e, x, y, 0); return this.curState.onMouseDown(e, x, y, 0);
}; };
...@@ -256,7 +256,7 @@ DrawingObjectsController.prototype.OnMouseDown = DrawingObjectsController.protot ...@@ -256,7 +256,7 @@ DrawingObjectsController.prototype.OnMouseDown = DrawingObjectsController.protot
DrawingObjectsController.prototype.onMouseMove = function(e, x, y) DrawingObjectsController.prototype.onMouseMove = function(e, x, y)
{ {
e.ShiftKey = e.shiftKey; e.ShiftKey = e.shiftKey;
e.CtrlKey = e.ctrlKey; e.CtrlKey = e.metaKey || e.ctrlKey;
this.curState.onMouseMove(e, x, y, 0); this.curState.onMouseMove(e, x, y, 0);
}; };
DrawingObjectsController.prototype.OnMouseMove = DrawingObjectsController.prototype.onMouseMove; DrawingObjectsController.prototype.OnMouseMove = DrawingObjectsController.prototype.onMouseMove;
...@@ -265,7 +265,7 @@ DrawingObjectsController.prototype.OnMouseMove = DrawingObjectsController.protot ...@@ -265,7 +265,7 @@ DrawingObjectsController.prototype.OnMouseMove = DrawingObjectsController.protot
DrawingObjectsController.prototype.onMouseUp = function(e, x, y) DrawingObjectsController.prototype.onMouseUp = function(e, x, y)
{ {
e.ShiftKey = e.shiftKey; e.ShiftKey = e.shiftKey;
e.CtrlKey = e.ctrlKey; e.CtrlKey = e.metaKey || e.ctrlKey;
this.curState.onMouseUp(e, x, y, 0); this.curState.onMouseUp(e, x, y, 0);
}; };
DrawingObjectsController.prototype.OnMouseUp = DrawingObjectsController.prototype.onMouseUp; DrawingObjectsController.prototype.OnMouseUp = DrawingObjectsController.prototype.onMouseUp;
......
This diff is collapsed.
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