Commit 7051b0f0 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix draw selection for dialogs

parent ade2bb12
...@@ -601,6 +601,11 @@ ...@@ -601,6 +601,11 @@
this.activeCellId = -1; this.activeCellId = -1;
this.activeCell.clean(); this.activeCell.clean();
}; };
SelectionRange.prototype.assign2 = function (range) {
this.clean();
this.getLast().assign2(range);
this.update();
};
SelectionRange.prototype.offsetCell = function (dr, dc, fCheckSize) { SelectionRange.prototype.offsetCell = function (dr, dc, fCheckSize) {
var done, curRange, mc; var done, curRange, mc;
var lastRow = this.activeCell.row; var lastRow = this.activeCell.row;
......
...@@ -3638,7 +3638,7 @@ ...@@ -3638,7 +3638,7 @@
// draw active cell in selection // draw active cell in selection
var isActive = AscCommonExcel.selectionLineType.ActiveCell & selectionLineType; var isActive = AscCommonExcel.selectionLineType.ActiveCell & selectionLineType;
if (isActive) { if (isActive) {
var cell = this.model.selectionRange.activeCell; var cell = (this.isSelectionDialogMode ? this.copyActiveRange : this.model.selectionRange).activeCell;
var fs = this.model.getMergedByCell(cell.row, cell.col); var fs = this.model.getMergedByCell(cell.row, cell.col);
fs = range.intersectionSimple( fs = range.intersectionSimple(
fs ? fs : new asc_Range(cell.col, cell.row, cell.col, cell.row)); fs ? fs : new asc_Range(cell.col, cell.row, cell.col, cell.row));
...@@ -3753,7 +3753,7 @@ ...@@ -3753,7 +3753,7 @@
var isOtherSelectionMode = this.isSelectionDialogMode || this.isFormulaEditMode; var isOtherSelectionMode = this.isSelectionDialogMode || this.isFormulaEditMode;
if (isOtherSelectionMode && !this.handlers.trigger('isActive')) { if (isOtherSelectionMode && !this.handlers.trigger('isActive')) {
if (this.isSelectionDialogMode) { if (this.isSelectionDialogMode) {
this._drawSelectRange(this.activeRange.clone(true)); this._drawSelectRange();
} else if (this.isFormulaEditMode) { } else if (this.isFormulaEditMode) {
this._drawFormulaRanges(this.arrActiveFormulaRanges); this._drawFormulaRanges(this.arrActiveFormulaRanges);
} }
...@@ -3777,7 +3777,7 @@ ...@@ -3777,7 +3777,7 @@
this._drawFormulaRanges(this.arrActiveChartsRanges); this._drawFormulaRanges(this.arrActiveChartsRanges);
} }
if (this.isSelectionDialogMode) { if (this.isSelectionDialogMode) {
this._drawSelectRange(this.activeRange.clone(true)); this._drawSelectRange();
} }
if (this.stateFormatPainter && this.handlers.trigger('isActive')) { if (this.stateFormatPainter && this.handlers.trigger('isActive')) {
this._drawFormatPainterRange(); this._drawFormatPainterRange();
...@@ -3798,9 +3798,10 @@ ...@@ -3798,9 +3798,10 @@
}; };
WorksheetView.prototype._drawSelectionRange = function () { WorksheetView.prototype._drawSelectionRange = function () {
var ranges = (this.isSelectionDialogMode ? this.copyActiveRange : this.model.selectionRange).ranges;
var range, selectionLineType; var range, selectionLineType;
for (var i = 0, l = this.model.selectionRange.ranges.length; i < l; ++i) { for (var i = 0, l = ranges.length; i < l; ++i) {
range = this.model.selectionRange.ranges[i]; range = ranges[i];
if (c_oAscSelectionType.RangeMax === range.type) { if (c_oAscSelectionType.RangeMax === range.type) {
range.c2 = this.cols.length - 1; range.c2 = this.cols.length - 1;
range.r2 = this.rows.length - 1; range.r2 = this.rows.length - 1;
...@@ -3845,9 +3846,12 @@ ...@@ -3845,9 +3846,12 @@
} }
}; };
WorksheetView.prototype._drawSelectRange = function (oSelectRange) { WorksheetView.prototype._drawSelectRange = function () {
this._drawElements(this._drawSelectionElement, oSelectRange, AscCommonExcel.selectionLineType.Dash, var ranges = this.model.selectionRange.ranges;
AscCommonExcel.c_oAscCoAuthoringOtherBorderColor); for (var i = 0, l = ranges.length; i < l; ++i) {
this._drawElements(this._drawSelectionElement, ranges[i], AscCommonExcel.selectionLineType.Dash,
AscCommonExcel.c_oAscCoAuthoringOtherBorderColor);
}
}; };
WorksheetView.prototype._drawCollaborativeElements = function () { WorksheetView.prototype._drawCollaborativeElements = function () {
...@@ -4119,19 +4123,22 @@ ...@@ -4119,19 +4123,22 @@
} }
if (null !== this.copyActiveRange) { if (null !== this.copyActiveRange) {
// Координаты для перемещения диапазона this.copyActiveRange.ranges.forEach(function (item) {
_x1 = this.cols[this.copyActiveRange.c1].left - offsetX - this.width_2px; var arnIntersection = item.intersectionSimple(range);
_x2 = this.cols[this.copyActiveRange.c2].left + this.cols[this.copyActiveRange.c2].width - offsetX + if (arnIntersection) {
this.width_1px + this.width_2px; _x1 = t.cols[arnIntersection.c1].left - offsetX - t.width_2px;
_y1 = this.rows[this.copyActiveRange.r1].top - offsetY - this.height_2px; _x2 = t.cols[arnIntersection.c2].left + t.cols[arnIntersection.c2].width - offsetX +
_y2 = this.rows[this.copyActiveRange.r2].top + this.rows[this.copyActiveRange.r2].height - offsetY + t.width_1px + /* Это ширина "квадрата" для автофильтра от границы ячейки */t.width_2px;
this.height_1px + this.height_2px; _y1 = t.rows[arnIntersection.r1].top - offsetY - t.height_2px;
_y2 = t.rows[arnIntersection.r2].top + t.rows[arnIntersection.r2].height - offsetY +
// Выбираем наибольший range для очистки t.height_1px + /* Это высота "квадрата" для автофильтра от границы ячейки */t.height_2px;
x1 = Math.min(x1, _x1);
x2 = Math.max(x2, _x2); x1 = Math.min(x1, _x1);
y1 = Math.min(y1, _y1); x2 = Math.max(x2, _x2);
y2 = Math.max(y2, _y2); y1 = Math.min(y1, _y1);
y2 = Math.max(y2, _y2);
}
});
} }
if (!(Number.MAX_VALUE === x1 && -Number.MAX_VALUE === x2 && Number.MAX_VALUE === y1 && if (!(Number.MAX_VALUE === x1 && -Number.MAX_VALUE === x2 && Number.MAX_VALUE === y1 &&
...@@ -10986,15 +10993,14 @@ ...@@ -10986,15 +10993,14 @@
if (false === this.isSelectionDialogMode) { if (false === this.isSelectionDialogMode) {
if (null !== this.copyActiveRange) { if (null !== this.copyActiveRange) {
this.activeRange = this.copyActiveRange.clone(true); this.model.selectionRange = this.copyActiveRange.clone();
} }
this.copyActiveRange = null; this.copyActiveRange = null;
if (oldSelectionDialogType === c_oAscSelectionDialogType.Chart) { if (oldSelectionDialogType === c_oAscSelectionDialogType.Chart) {
this.objectRender.controller.checkChartForProps(false); this.objectRender.controller.checkChartForProps(false);
} }
} else { } else {
this.copyActiveRange = this.model.selectionRange.clone();
this.copyActiveRange = this.activeRange.clone(true);
if (selectRange) { if (selectRange) {
if (typeof selectRange === 'string') { if (typeof selectRange === 'string') {
selectRange = this.model.getRange2(selectRange); selectRange = this.model.getRange2(selectRange);
...@@ -11004,7 +11010,7 @@ ...@@ -11004,7 +11010,7 @@
} }
if (null != selectRange) { if (null != selectRange) {
this.activeRange.assign(selectRange.c1, selectRange.r1, selectRange.c2, selectRange.r2); this.model.selectionRange.assign2(selectRange);
} }
} }
if (selectionDialogType === c_oAscSelectionDialogType.Chart) { if (selectionDialogType === c_oAscSelectionDialogType.Chart) {
......
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