Commit 18d3f456 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

В asc_CEventsController scrollVertical и scrollHorizontal объединил в один scroll.

Теперь handlers не для каждого WorksheetView, а для всех одни.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57630 954022d7-b5bf-4e40-9824-e11837661b57
parent 50aea9d5
......@@ -253,6 +253,16 @@
return this;
};
/**
* @param delta {Object}
*/
asc_CEventsController.prototype.scroll = function (delta) {
if (delta) {
if (delta.deltaX) {this.scrollHorizontal(delta.deltaX);}
if (delta.deltaY) {this.scrollVertical(delta.deltaY);}
}
};
/**
* @param delta {Number}
* @param [event] {MouseEvent}
......@@ -403,8 +413,7 @@
this.handlers.trigger("changeSelection", /*isStartPoint*/false, coord.x, coord.y,
/*isCoord*/true, /*isSelectMode*/isSelectMode,
function (d) {
if (d.deltaX) {t.scrollHorizontal(d.deltaX);}
if (d.deltaY) {t.scrollVertical(d.deltaY);}
t.scroll(d);
if (t.isFormulaEditMode)
t.handlers.trigger("enterCellRange");
......@@ -516,8 +525,7 @@
this.handlers.trigger("changeFillHandle", coord.x, coord.y,
function (d) {
if (!d) return;
if (d.deltaX) {t.scrollHorizontal(d.deltaX);}
if (d.deltaY) {t.scrollVertical(d.deltaY);}
t.scroll(d);
asc_applyFunction(callback);
});
};
......@@ -562,8 +570,7 @@
this.handlers.trigger("moveRangeHandle", coord.x, coord.y,
function (d) {
if (!d) return;
if (d.deltaX) {t.scrollHorizontal(d.deltaX);}
if (d.deltaY) {t.scrollVertical(d.deltaY);}
t.scroll(d);
asc_applyFunction(callback);
}, event.metaKey || event.ctrlKey);
};
......@@ -601,8 +608,7 @@
this.handlers.trigger("moveResizeRangeHandle", coord.x, coord.y, target,
function (d) {
if (!d) return;
if (d.deltaX) {t.scrollHorizontal(d.deltaX);}
if (d.deltaY) {t.scrollVertical(d.deltaY);}
t.scroll(d);
asc_applyFunction(callback);
});
};
......@@ -942,11 +948,7 @@
// Проверка на движение в выделенной области
if (selectionActivePointChanged) {
t.handlers.trigger("selectionActivePointChanged", dc, dr,
function (d) {
if (d.deltaX) {t.scrollHorizontal(d.deltaX);}
if (d.deltaY) {t.scrollVertical(d.deltaY);}
});
t.handlers.trigger("selectionActivePointChanged", dc, dr, function (d) {t.scroll(d);});
} else {
if (this.isCellEditMode && !this.isFormulaEditMode) {
if (!t.handlers.trigger("stopCellEditing")) {return true;}
......@@ -962,8 +964,7 @@
t.handlers.trigger("changeSelection", /*isStartPoint*/!shiftKey, dc, dr,
/*isCoord*/false, /*isSelectMode*/false,
function (d) {
if (d.deltaX) {t.scrollHorizontal(d.deltaX);}
if (d.deltaY) {t.scrollVertical(d.deltaY);}
t.scroll(d);
if (t.isFormulaEditMode) {
t.handlers.trigger("enterCellRange");
......@@ -1291,8 +1292,7 @@
t.handlers.trigger("changeSelection", /*isStartPoint*/true, coord.x, coord.y,
/*isCoord*/true, /*isSelectMode*/true,
function (d) {
if (d.deltaX) {t.scrollHorizontal(d.deltaX);}
if (d.deltaY) {t.scrollVertical(d.deltaY);}
t.scroll(d);
if (t.isFormulaEditMode) {
t.handlers.trigger("enterCellRange");
......
......@@ -76,6 +76,7 @@
this.model = model;
this.controller = controller;
this.handlers = handlers;
this.wsViewHandlers = null;
this.element = elem;
this.input = inputElem;
this.settings = $.extend(true, {}, this.defaults, settings);
......@@ -347,6 +348,24 @@
});
}
this.wsViewHandlers = new asc.asc_CHandlersList(/*handlers*/{
"getViewerMode" : function () { return self.controller.getViewerMode ? self.controller.getViewerMode() : true; },
"reinitializeScroll" : function () {self.controller.reinitializeScroll(/*All*/);},
"reinitializeScrollY" : function () {self.controller.reinitializeScroll(/*vertical*/1);},
"reinitializeScrollX" : function () {self.controller.reinitializeScroll(/*horizontal*/2);},
"selectionChanged" : function () {self._onWSSelectionChanged.apply(self, arguments);},
"selectionNameChanged" : function () {self._onSelectionNameChanged.apply(self, arguments);},
"selectionMathInfoChanged" : function () {self._onSelectionMathInfoChanged.apply(self, arguments);},
"onErrorEvent" : function (errorId, level) {self.handlers.trigger("asc_onError", errorId, level);},
"slowOperation" : function (isStart) {self.handlers.trigger((isStart ? "asc_onStartAction" : "asc_onEndAction"), c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.SlowOperation);},
"setAutoFiltersDialog" : function (arrVal) {self.handlers.trigger("asc_onSetAFDialog", arrVal);},
"selectionRangeChanged" : function (val) {self.handlers.trigger("asc_onSelectionRangeChanged", val);},
"onRenameCellTextEnd" : function (countFind, countReplace) {self.handlers.trigger("asc_onRenameCellTextEnd", countFind, countReplace);},
"onStopFormatPainter" : function () {self.handlers.trigger("asc_onStopFormatPainter");},
"onDocumentPlaceChanged" : function () {self._onDocumentPlaceChanged();},
"updateSheetViewSettings" : function () {self.handlers.trigger("asc_onUpdateSheetViewSettings");}
});
this.model.handlers.add("cleanCellCache", function (wsId, range, canChangeColWidth, bLockDraw) {
var ws = self.getWorksheetById(wsId);
if (ws)
......@@ -484,24 +503,8 @@
};
WorkbookView.prototype._createWorksheetView = function (wsModel) {
var self = this, opt = $.extend(true, {}, this.settings.worksheetDefaults);
return new asc_WSV(wsModel, /*handlers*/{
"getViewerMode" : function () { return self.controller.getViewerMode ? self.controller.getViewerMode() : true; },
"reinitializeScroll" : function () {self.controller.reinitializeScroll(/*All*/);},
"reinitializeScrollY" : function () {self.controller.reinitializeScroll(/*vertical*/1);},
"reinitializeScrollX" : function () {self.controller.reinitializeScroll(/*horizontal*/2);},
"selectionChanged" : function () {self._onWSSelectionChanged.apply(self, arguments);},
"selectionNameChanged" : function () {self._onSelectionNameChanged.apply(self, arguments);},
"selectionMathInfoChanged" : function () {self._onSelectionMathInfoChanged.apply(self, arguments);},
"onErrorEvent" : function (errorId, level) {self.handlers.trigger("asc_onError", errorId, level);},
"slowOperation" : function (isStart) {self.handlers.trigger((isStart ? "asc_onStartAction" : "asc_onEndAction"), c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.SlowOperation);},
"setAutoFiltersDialog" : function (arrVal) {self.handlers.trigger("asc_onSetAFDialog", arrVal);},
"selectionRangeChanged" : function (val) {self.handlers.trigger("asc_onSelectionRangeChanged", val);},
"onRenameCellTextEnd" : function (countFind, countReplace) {self.handlers.trigger("asc_onRenameCellTextEnd", countFind, countReplace);},
"onStopFormatPainter" : function () {self.handlers.trigger("asc_onStopFormatPainter");},
"onDocumentPlaceChanged" : function () {self._onDocumentPlaceChanged();},
"updateSheetViewSettings" : function () {self.handlers.trigger("asc_onUpdateSheetViewSettings");}
}, this.buffers, this.stringRender, this.maxDigitWidth, this.collaborativeEditing, opt);
var opt = $.extend(true, {}, this.settings.worksheetDefaults);
return new asc_WSV(wsModel, this.wsViewHandlers, this.buffers, this.stringRender, this.maxDigitWidth, this.collaborativeEditing, opt);
};
WorkbookView.prototype._onSelectionNameChanged = function (name) {
......@@ -577,10 +580,7 @@
var ws = this.getWorksheet();
ws._checkSelectionShape();
var d = ws.setSelectionUndoRedo(range, validRange);
if (d) {
if (d.deltaX) {this.controller.scrollHorizontal(d.deltaX);}
if (d.deltaY) {this.controller.scrollVertical(d.deltaY);}
}
this.controller.scroll(d);
};
WorkbookView.prototype._onGetSelection = function () {
......@@ -602,10 +602,7 @@
ws.objectRender.controller.setSelectionState(state);
ws.setSelectionShape(true);
var d = ws._calcActiveCellOffset(ws.objectRender.getSelectedDrawingsRange());
if (d) {
if (d.deltaX) {this.controller.scrollHorizontal(d.deltaX);}
if (d.deltaY) {this.controller.scrollVertical(d.deltaY);}
}
this.controller.scroll(d);
ws.objectRender.showDrawingObjectsEx(true);
ws.objectRender.controller.updateOverlay();
ws.objectRender.controller.updateSelectionState();
......
......@@ -331,7 +331,7 @@
* Widget for displaying and editing Worksheet object
* -----------------------------------------------------------------------------
* @param {Woorksheet} model Worksheet
* @param {Object} handlers Event handlers
* @param {asc_CHandlersList} handlers Event handlers
* @param {Object} buffers DrawingContext + Overlay
* @param {StringRender} stringRender StringRender
* @param {Number} maxDigitWidth Максимальный размер цифры
......@@ -342,10 +342,6 @@
* @memberOf Asc
*/
function WorksheetView(model, handlers, buffers, stringRender, maxDigitWidth, collaborativeEditing, settings) {
if ( !(this instanceof WorksheetView) ) {
return new WorksheetView(model, handlers, buffers, stringRender, maxDigitWidth, collaborativeEditing, settings);
}
this.defaults = new WorksheetViewSettings();
this.settings = $.extend(true, {}, this.defaults, settings);
......@@ -355,8 +351,7 @@
this.vspRatio = 1.275;
this.handlers = new asc.asc_CHandlersList(handlers);
this.handlers = handlers;
this.model = model;
this.buffers = buffers;
......
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