Commit b458d4dc authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix format painter select

parent 7051b0f0
...@@ -3824,8 +3824,10 @@ ...@@ -3824,8 +3824,10 @@
}; };
WorksheetView.prototype._drawFormatPainterRange = function () { WorksheetView.prototype._drawFormatPainterRange = function () {
this._drawElements(this._drawSelectionElement, this.copyActiveRange, AscCommonExcel.selectionLineType.Dash, var t = this, color = new CColor(0, 0, 0);
new CColor(0, 0, 0)); this.copyActiveRange.ranges.forEach(function (item) {
t._drawElements(t._drawSelectionElement, item, AscCommonExcel.selectionLineType.Dash, color);
});
}; };
WorksheetView.prototype._drawFormulaRanges = function (arrRanges) { WorksheetView.prototype._drawFormulaRanges = function (arrRanges) {
...@@ -7542,7 +7544,7 @@ ...@@ -7542,7 +7544,7 @@
// Окончание выделения // Окончание выделения
WorksheetView.prototype.changeSelectionDone = function () { WorksheetView.prototype.changeSelectionDone = function () {
if ( this.stateFormatPainter ) { if (this.stateFormatPainter) {
this.applyFormatPainter(); this.applyFormatPainter();
} }
}; };
...@@ -7574,42 +7576,44 @@ ...@@ -7574,42 +7576,44 @@
WorksheetView.prototype.applyFormatPainter = function () { WorksheetView.prototype.applyFormatPainter = function () {
var t = this; var t = this;
var from = t.handlers.trigger('getRangeFormatPainter'), to = t.activeRange.getAllRange(); var from = t.handlers.trigger('getRangeFormatPainter').getLast(), to = this.model.selectionRange.getLast().getAllRange();
var onApplyFormatPainterCallback = function ( isSuccess ) { var onApplyFormatPainterCallback = function (isSuccess) {
// Очищаем выделение // Очищаем выделение
t.cleanSelection(); t.cleanSelection();
if ( true === isSuccess ) { if (true === isSuccess) {
AscCommonExcel.promoteFromTo(from, t.model, to, t.model); AscCommonExcel.promoteFromTo(from, t.model, to, t.model);
} }
t.expandColsOnScroll( false, true, to.c2 + 1 ); t.expandColsOnScroll(false, true, to.c2 + 1);
t.expandRowsOnScroll( false, true, to.r2 + 1 ); t.expandRowsOnScroll(false, true, to.r2 + 1);
// Сбрасываем параметры // Сбрасываем параметры
t._updateCellsRange( to, /*canChangeColWidth*/c_oAscCanChangeColWidth.none, /*lockDraw*/true ); t._updateCellsRange(to, /*canChangeColWidth*/c_oAscCanChangeColWidth.none, /*lockDraw*/true);
if ( c_oAscFormatPainterState.kMultiple !== t.stateFormatPainter ) { if (c_oAscFormatPainterState.kMultiple !== t.stateFormatPainter) {
t.handlers.trigger('onStopFormatPainter'); t.handlers.trigger('onStopFormatPainter');
} }
// Перерисовываем // Перерисовываем
t._recalculateAfterUpdate( [to] ); t._recalculateAfterUpdate([to]);
}; };
var result = AscCommonExcel.preparePromoteFromTo( from, to ); var result = AscCommonExcel.preparePromoteFromTo(from, to);
if ( !result ) { if (!result) {
// ToDo вывести ошибку // ToDo вывести ошибку
onApplyFormatPainterCallback( false ); onApplyFormatPainterCallback(false);
return; return;
} }
this._isLockedCells( to, null, onApplyFormatPainterCallback ); this._isLockedCells(to, null, onApplyFormatPainterCallback);
}; };
WorksheetView.prototype.formatPainter = function(stateFormatPainter) { WorksheetView.prototype.formatPainter = function (stateFormatPainter) {
// Если передали состояние, то выставляем его. Если нет - то меняем на противоположное. // Если передали состояние, то выставляем его. Если нет - то меняем на противоположное.
this.stateFormatPainter = (null != stateFormatPainter) ? stateFormatPainter : ((c_oAscFormatPainterState.kOff !== this.stateFormatPainter) ? c_oAscFormatPainterState.kOff : c_oAscFormatPainterState.kOn); this.stateFormatPainter = (null != stateFormatPainter) ? stateFormatPainter :
((c_oAscFormatPainterState.kOff !== this.stateFormatPainter) ? c_oAscFormatPainterState.kOff :
c_oAscFormatPainterState.kOn);
if (this.stateFormatPainter) { if (this.stateFormatPainter) {
this.copyActiveRange = this.activeRange.clone(true); this.copyActiveRange = this.model.selectionRange.clone();
this._drawFormatPainterRange(); this._drawFormatPainterRange();
} else { } else {
this.cleanSelection(); this.cleanSelection();
......
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