Commit 48c46646 authored by Alexander.Trofimov's avatar Alexander.Trofimov

Merge remote-tracking branch 'origin/hotfix/v4.2.8' into develop

# Conflicts:
#	cell/view/EventsController.js
#	common/editorscommon.js
parents d5f318de 2f686fce
...@@ -3104,16 +3104,12 @@ cROUND.prototype.Calculate = function ( arg ) { ...@@ -3104,16 +3104,12 @@ cROUND.prototype.Calculate = function ( arg ) {
return Math[n > 0 ? "floor" : "ceil"]( n ); return Math[n > 0 ? "floor" : "ceil"]( n );
} }
function sign( n ) {
return n == 0 ? 0 : n < 0 ? -1 : 1
}
function Floor( number, significance ) { function Floor( number, significance ) {
var quotient = number / significance; var quotient = number / significance;
if ( quotient == 0 ) { if ( quotient == 0 ) {
return 0; return 0;
} }
var nolpiat = 5 * sign( quotient ) * Math.pow( 10, Math.floor( Math.log10( Math.abs( quotient ) ) ) - cExcelSignificantDigits ); var nolpiat = 5 * Math.sign( quotient ) * Math.pow( 10, Math.floor( Math.log10( Math.abs( quotient ) ) ) - cExcelSignificantDigits );
return truncate( quotient + nolpiat ) * significance; return truncate( quotient + nolpiat ) * significance;
} }
......
...@@ -616,9 +616,12 @@ Math.approxEqual = function ( a, b ) { ...@@ -616,9 +616,12 @@ Math.approxEqual = function ( a, b ) {
return this.abs( a - b ) < 1e-15; return this.abs( a - b ) < 1e-15;
}; };
Math.sign = function ( x ) { if (typeof Math.sign != 'function') {
return x > 0 ? 1 : x < 0 ? -1 : 0; Math['sign'] = Math.sign = function (n) {
}; return n == 0 ? 0 : n < 0 ? -1 : 1;
};
}
RegExp.escape = function ( text ) { RegExp.escape = function ( text ) {
return text.replace( /[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&" ); return text.replace( /[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&" );
......
...@@ -356,16 +356,12 @@ cDOLLAR.prototype.Calculate = function ( arg ) { ...@@ -356,16 +356,12 @@ cDOLLAR.prototype.Calculate = function ( arg ) {
return Math[n > 0 ? "floor" : "ceil"]( n ); return Math[n > 0 ? "floor" : "ceil"]( n );
} }
function sign( n ) {
return n == 0 ? 0 : n < 0 ? -1 : 1
}
function Floor( number, significance ) { function Floor( number, significance ) {
var quotient = number / significance; var quotient = number / significance;
if ( quotient == 0 ) { if ( quotient == 0 ) {
return 0; return 0;
} }
var nolpiat = 5 * sign( quotient ) * Math.pow( 10, Math.floor( Math.log10( Math.abs( quotient ) ) ) - AscCommonExcel.cExcelSignificantDigits ); var nolpiat = 5 * Math.sign( quotient ) * Math.pow( 10, Math.floor( Math.log10( Math.abs( quotient ) ) ) - AscCommonExcel.cExcelSignificantDigits );
return truncate( quotient + nolpiat ) * significance; return truncate( quotient + nolpiat ) * significance;
} }
...@@ -703,16 +699,12 @@ cFIXED.prototype.Calculate = function ( arg ) { ...@@ -703,16 +699,12 @@ cFIXED.prototype.Calculate = function ( arg ) {
return Math[n > 0 ? "floor" : "ceil"]( n ); return Math[n > 0 ? "floor" : "ceil"]( n );
} }
function sign( n ) {
return n == 0 ? 0 : n < 0 ? -1 : 1
}
function Floor( number, significance ) { function Floor( number, significance ) {
var quotient = number / significance; var quotient = number / significance;
if ( quotient == 0 ) { if ( quotient == 0 ) {
return 0; return 0;
} }
var nolpiat = 5 * sign( quotient ) * Math.pow( 10, Math.floor( Math.log10( Math.abs( quotient ) ) ) - AscCommonExcel.cExcelSignificantDigits ); var nolpiat = 5 * Math.sign( quotient ) * Math.pow( 10, Math.floor( Math.log10( Math.abs( quotient ) ) ) - AscCommonExcel.cExcelSignificantDigits );
return truncate( quotient + nolpiat ) * significance; return truncate( quotient + nolpiat ) * significance;
} }
......
...@@ -2163,7 +2163,7 @@ ...@@ -2163,7 +2163,7 @@
*/ */
CellEditor.prototype._onWindowKeyDown = function (event, isInput) { CellEditor.prototype._onWindowKeyDown = function (event, isInput) {
var t = this, kind = undefined, hieroglyph = false; var t = this, kind = undefined, hieroglyph = false;
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
if (!t.isOpened || (!isInput && !t.enableKeyEvents)) { if (!t.isOpened || (!isInput && !t.enableKeyEvents)) {
return true; return true;
......
...@@ -310,7 +310,7 @@ ...@@ -310,7 +310,7 @@
// Будем делать dblClick как в Excel // Будем делать dblClick как в Excel
asc_CEventsController.prototype.doMouseDblClick = function (event, isHideCursor) { asc_CEventsController.prototype.doMouseDblClick = function (event, isHideCursor) {
var t = this; var t = this;
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
// Для формулы не нужно выходить из редактирования ячейки // Для формулы не нужно выходить из редактирования ячейки
if (t.settings.isViewerMode || t.isFormulaEditMode || t.isSelectionDialogMode) {return true;} if (t.settings.isViewerMode || t.isFormulaEditMode || t.isSelectionDialogMode) {return true;}
...@@ -515,7 +515,7 @@ ...@@ -515,7 +515,7 @@
*/ */
asc_CEventsController.prototype._changeSelectionDone = function (event) { asc_CEventsController.prototype._changeSelectionDone = function (event) {
var coord = this._getCoordinates(event); var coord = this._getCoordinates(event);
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
if (false === ctrlKey) { if (false === ctrlKey) {
coord.x = -1; coord.x = -1;
coord.y = -1; coord.y = -1;
...@@ -578,7 +578,8 @@ ...@@ -578,7 +578,8 @@
asc_CEventsController.prototype._changeFillHandleDone = function (event) { asc_CEventsController.prototype._changeFillHandleDone = function (event) {
// Закончили автозаполнение, пересчитаем // Закончили автозаполнение, пересчитаем
var coord = this._getCoordinates(event); var coord = this._getCoordinates(event);
this.handlers.trigger("changeFillHandleDone", coord.x, coord.y, event.metaKey || event.ctrlKey); var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
this.handlers.trigger("changeFillHandleDone", coord.x, coord.y, ctrlKey);
}; };
/** /**
...@@ -648,7 +649,8 @@ ...@@ -648,7 +649,8 @@
/** @param event {MouseEvent} */ /** @param event {MouseEvent} */
asc_CEventsController.prototype._moveRangeHandleDone = function (event) { asc_CEventsController.prototype._moveRangeHandleDone = function (event) {
// Закончили перемещение диапазона, пересчитаем // Закончили перемещение диапазона, пересчитаем
this.handlers.trigger("moveRangeHandleDone", event.metaKey || event.ctrlKey); var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
this.handlers.trigger("moveRangeHandleDone", ctrlKey);
}; };
asc_CEventsController.prototype._moveResizeRangeHandleDone = function (event, target) { asc_CEventsController.prototype._moveResizeRangeHandleDone = function (event, target) {
...@@ -666,7 +668,7 @@ ...@@ -666,7 +668,7 @@
/** @param event {KeyboardEvent} */ /** @param event {KeyboardEvent} */
asc_CEventsController.prototype._onWindowKeyDown = function (event) { asc_CEventsController.prototype._onWindowKeyDown = function (event) {
var t = this, dc = 0, dr = 0, isViewerMode = t.settings.isViewerMode, action = false; var t = this, dc = 0, dr = 0, isViewerMode = t.settings.isViewerMode, action = false;
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
var shiftKey = event.shiftKey; var shiftKey = event.shiftKey;
var result = true; var result = true;
...@@ -1268,7 +1270,7 @@ ...@@ -1268,7 +1270,7 @@
} }
var t = this; var t = this;
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
var coord = t._getCoordinates(event); var coord = t._getCoordinates(event);
event.isLocked = t.isMousePressed = true; event.isLocked = t.isMousePressed = true;
...@@ -1509,7 +1511,7 @@ ...@@ -1509,7 +1511,7 @@
/** @param event {MouseEvent} */ /** @param event {MouseEvent} */
asc_CEventsController.prototype._onMouseMove = function (event) { asc_CEventsController.prototype._onMouseMove = function (event) {
var t = this; var t = this;
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
var coord = t._getCoordinates(event); var coord = t._getCoordinates(event);
t.hasCursor = true; t.hasCursor = true;
...@@ -1587,7 +1589,7 @@ ...@@ -1587,7 +1589,7 @@
/** @param event {MouseEvent} */ /** @param event {MouseEvent} */
asc_CEventsController.prototype._onMouseWheel = function (event) { asc_CEventsController.prototype._onMouseWheel = function (event) {
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
if (this.isFillHandleMode || this.isMoveRangeMode || this.isMoveResizeRange || ctrlKey) { if (this.isFillHandleMode || this.isMoveRangeMode || this.isMoveResizeRange || ctrlKey) {
return true; return true;
} }
...@@ -1598,25 +1600,44 @@ ...@@ -1598,25 +1600,44 @@
return true; return true;
} }
var delta = 0; var self = this;
var deltaX = 0, deltaY = 0;
if (undefined !== event.wheelDelta && 0 !== event.wheelDelta) { if (undefined !== event.wheelDelta && 0 !== event.wheelDelta) {
delta = -1 * event.wheelDelta / 40; deltaY = -1 * event.wheelDelta / 40;
} else if (undefined != event.detail && 0 !== event.detail) { } else if (undefined !== event.detail && 0 !== event.detail) {
// FF
delta = event.detail;
} else if (undefined != event.deltaY && 0 !== event.deltaY) {
// FF // FF
delta = event.deltaY; deltaY = event.detail;
}
if (event.axis !== undefined && event.axis === event.HORIZONTAL_AXIS) {
deltaX = deltaY;
deltaY = 0;
}
if (undefined !== event.wheelDeltaX && 0 !== event.wheelDeltaX) {
// Webkit
deltaX = -1 * event.wheelDeltaX / 40;
}
if (undefined !== event.wheelDeltaY && 0 !== event.wheelDeltaY) {
// Webkit
deltaY = -1 * event.wheelDeltaY / 40;
}
if (event.shiftKey) {
deltaX = deltaY;
deltaY = 0;
} }
delta /= 3;
var self = this;
delta *= event.shiftKey ? 1 : this.settings.wheelScrollLines;
this.handlers.trigger("updateWorksheet", this.element, /*x*/undefined, /*y*/undefined, /*ctrlKey*/undefined, this.handlers.trigger("updateWorksheet", this.element, /*x*/undefined, /*y*/undefined, /*ctrlKey*/undefined,
function () { function () {
event.shiftKey ? self.scrollHorizontal(delta, event) : self.scrollVertical(delta, event); if (deltaX) {
self._onMouseMove(event); deltaX = Math.sign(deltaX) * Math.ceil(Math.abs(deltaX / 3));
}); self.scrollHorizontal(deltaX, event);
}
if (deltaY) {
deltaY = Math.sign(deltaY) * Math.ceil(Math.abs(deltaY * self.settings.wheelScrollLines / 3));
self.scrollVertical(deltaY, event);
}
self._onMouseMove(event);
});
return true; return true;
}; };
......
...@@ -176,20 +176,8 @@ ...@@ -176,20 +176,8 @@
function check_KeyboardEvent(e) function check_KeyboardEvent(e)
{ {
global_keyboardEvent.AltKey = e.altKey; global_keyboardEvent.AltKey = e.altKey;
global_keyboardEvent.AltGr = AscCommon.getAltGr(e);
if (e.metaKey !== undefined) global_keyboardEvent.CtrlKey = !global_keyboardEvent.AltGr && (e.metaKey || e.ctrlKey);
global_keyboardEvent.CtrlKey = e.ctrlKey || e.metaKey;
else
global_keyboardEvent.CtrlKey = e.ctrlKey;
global_keyboardEvent.AltGr = (global_keyboardEvent.CtrlKey && global_keyboardEvent.AltKey) ? true : false;
if (AscBrowser.isMacOs)
{
global_keyboardEvent.AltGr = (!global_keyboardEvent.CtrlKey && global_keyboardEvent.AltKey) ? true : false;
}
if (global_keyboardEvent.AltGr)
global_keyboardEvent.CtrlKey = false;
global_keyboardEvent.ShiftKey = e.shiftKey; global_keyboardEvent.ShiftKey = e.shiftKey;
......
...@@ -2316,6 +2316,11 @@ CUserCacheColor.prototype.init = function(nColor) { ...@@ -2316,6 +2316,11 @@ CUserCacheColor.prototype.init = function(nColor) {
loadScript('./../../../../sdkjs/' + sdkName + '/sdk-all.js', callback); loadScript('./../../../../sdkjs/' + sdkName + '/sdk-all.js', callback);
} }
} }
function getAltGr (e) {
var ctrlKey = e.metaKey || e.ctrlKey;
var altKey = e.altKey;
return (altKey && (AscBrowser.isMacOs ? !ctrlKey : ctrlKey));
}
function getColorThemeByIndex(index) { function getColorThemeByIndex(index) {
var _c, scheme = null; var _c, scheme = null;
...@@ -2404,6 +2409,7 @@ window["SetDoctRendererParams"] = function(_params) ...@@ -2404,6 +2409,7 @@ window["SetDoctRendererParams"] = function(_params)
window["AscCommon"].CContentChangesElement = CContentChangesElement; window["AscCommon"].CContentChangesElement = CContentChangesElement;
window["AscCommon"].loadSdk = loadSdk; window["AscCommon"].loadSdk = loadSdk;
window["AscCommon"].getAltGr = getAltGr;
window["AscCommon"].getColorThemeByIndex = getColorThemeByIndex; window["AscCommon"].getColorThemeByIndex = getColorThemeByIndex;
window["AscCommon"].g_oDocumentUrls = g_oDocumentUrls; window["AscCommon"].g_oDocumentUrls = g_oDocumentUrls;
......
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