Commit 3865316a authored by Alexey.Musinov's avatar Alexey.Musinov

up

parent 2de28ba9
...@@ -3229,6 +3229,9 @@ function OfflineEditor () { ...@@ -3229,6 +3229,9 @@ function OfflineEditor () {
if (-1 !== index) { if (-1 !== index) {
if (isColHeader) { if (isColHeader) {
if (w < this.width_1px) { if (w < this.width_1px) {
if (style !== kHeaderDefault) {
return;
}
// Это невидимый столбец // Это невидимый столбец
isZeroHeader = true; isZeroHeader = true;
// Отрисуем только границу // Отрисуем только границу
...@@ -3245,6 +3248,9 @@ function OfflineEditor () { ...@@ -3245,6 +3248,9 @@ function OfflineEditor () {
} }
} else { } else {
if (h < this.height_1px) { if (h < this.height_1px) {
if (style !== kHeaderDefault) {
return;
}
// Это невидимая строка // Это невидимая строка
isZeroHeader = true; isZeroHeader = true;
// Отрисуем только границу // Отрисуем только границу
...@@ -3261,37 +3267,37 @@ function OfflineEditor () { ...@@ -3261,37 +3267,37 @@ function OfflineEditor () {
} }
} }
} }
var ctx = (drawingCtx) ? drawingCtx : this.drawingCtx; var ctx = (drawingCtx) ? drawingCtx : this.drawingCtx;
var st = this.settings.header.style[style]; var st = this.settings.header.style[style];
var x2 = x + w; var x2 = x + w;
var y2 = y + h; var y2 = y + h;
var x2WithoutBorder = x2 - this.width_1px; var x2WithoutBorder = x2 - this.width_1px;
var y2WithoutBorder = y2 - this.height_1px; var y2WithoutBorder = y2 - this.height_1px;
// background только для видимых // background только для видимых
if (!isZeroHeader) { if (!isZeroHeader) {
// draw background // draw background
ctx.setFillStyle(st.background) ctx.setFillStyle(st.background)
.fillRect(x, y, w + 20, h + 20); .fillRect(x, y, w + 5, h + 5);
} }
// draw border // draw border
ctx.setStrokeStyle(st.border) ctx.setStrokeStyle(st.border)
.setLineWidth(1) .setLineWidth(1)
.beginPath(); .beginPath();
if (style !== kHeaderDefault && !isColHeader) { if (style !== kHeaderDefault && !isColHeader) {
// Select row (top border) // Select row (top border)
ctx.lineHorPrevPx(x, y, x2); // ctx.lineHorPrevPx(x, y, x2);
} }
// Right border // Right border
if (isColHeader) ctx.lineVerPrevPx(x2, y, y2); if (isColHeader) ctx.lineVerPrevPx(x2, y, y2 + 5);
// Bottom border // Bottom border
if (!isColHeader)ctx.lineHorPrevPx(x, y2, x2); if (!isColHeader) ctx.lineHorPrevPx(x, y2, x2 + 5);
if (style !== kHeaderDefault && isColHeader) { if (style !== kHeaderDefault && isColHeader) {
// Select col (left border) // Select col (left border)
//ctx.lineVerPrevPx(x, y, y2); ctx.lineVerPrevPx(x, y, y2);
} }
ctx.stroke(); ctx.stroke();
...@@ -3300,58 +3306,57 @@ function OfflineEditor () { ...@@ -3300,58 +3306,57 @@ function OfflineEditor () {
return; return;
// draw text // draw text
var text = isColHeader ? this._getColumnTitle(index) : this._getRowTitle(index); var text = isColHeader ? this._getColumnTitle(index) : this._getRowTitle(index);
var sr = this.stringRender; var sr = this.stringRender;
var tm = this._roundTextMetrics( sr.measureString(text) ); var tm = this._roundTextMetrics(sr.measureString(text));
var bl = y2WithoutBorder - (isColHeader ? this.defaultRowDescender : this.rows[index].descender); var bl = y2WithoutBorder - (isColHeader ? this.defaultRowDescender : this.rows[index].descender);
var textX = this._calcTextHorizPos(x, x2WithoutBorder, tm, tm.width < w ? AscCommon.align_Center : AscCommon.align_Left); var textX = this._calcTextHorizPos(x, x2WithoutBorder, tm, tm.width < w ? AscCommon.align_Center : AscCommon.align_Left);
var textY = this._calcTextVertPos(y, y2WithoutBorder, bl, tm, Asc.c_oAscVAlign.Bottom); var textY = this._calcTextVertPos(y, y2WithoutBorder, bl, tm, Asc.c_oAscVAlign.Bottom);
if (drawingCtx) { if (drawingCtx) {
ctx.AddClipRect(x, y, w, h); ctx.AddClipRect(x, y, w, h);
ctx.setFillStyle(st.color) ctx.setFillStyle(st.color)
.fillText(text, textX, textY + tm.baseline, undefined, sr.charWidths); .fillText(text, textX, textY + tm.baseline, undefined, sr.charWidths);
ctx.RemoveClipRect(); ctx.RemoveClipRect();
} else { } else {
ctx.save() ctx.save()
.beginPath() .beginPath()
.rect(x, y, w, h) .rect(x, y, w, h)
.clip() .clip()
.setFillStyle(st.color) .setFillStyle(st.color)
.fillText(text, textX, textY + tm.baseline, undefined, sr.charWidths) .fillText(text, textX, textY + tm.baseline, undefined, sr.charWidths)
.restore(); .restore();
} }
}; };
AscCommonExcel.WorksheetView.prototype.__drawRowHeaders = function (drawingCtx, start, end, style, offsetXForDraw, offsetYForDraw) { AscCommonExcel.WorksheetView.prototype.__drawRowHeaders = function (drawingCtx, start, end, style, offsetXForDraw, offsetYForDraw) {
if (undefined === drawingCtx && false === this.model.sheetViews[0].asc_getShowRowColHeaders()) if (undefined === drawingCtx && false === this.model.sheetViews[0].asc_getShowRowColHeaders()) {
return; return;
}
var range = new asc_Range(0, start, 1, end); var vr = this.visibleRange;
this._prepareCellTextMetricsCache(range);
var vr = this.visibleRange;
var r = this.rows; var r = this.rows;
var offsetX = (undefined !== offsetXForDraw) ? offsetXForDraw : this.headersLeft; var offsetX = (undefined !== offsetXForDraw) ? offsetXForDraw : this.headersLeft;
var offsetY = (undefined !== offsetYForDraw) ? offsetYForDraw : r[vr.r1].top - this.cellsTop; var offsetY = (undefined !== offsetYForDraw) ? offsetYForDraw : r[vr.r1].top - this.cellsTop;
if (undefined === drawingCtx && this.topLeftFrozenCell && undefined === offsetYForDraw) { if (undefined === drawingCtx && this.topLeftFrozenCell && undefined === offsetYForDraw) {
var rFrozen = this.topLeftFrozenCell.getRow0(); var rFrozen = this.topLeftFrozenCell.getRow0();
if (start < vr.r1) if (start < vr.r1) {
offsetY = r[0].top - this.cellsTop; offsetY = r[0].top - this.cellsTop;
else } else {
offsetY -= r[rFrozen].top - r[0].top; offsetY -= r[rFrozen].top - r[0].top;
}
} }
if (asc_typeof(start) !== "number") {start = vr.r1;} if (asc_typeof(start) !== "number") {
if (asc_typeof(end) !== "number") {end = vr.r2;} start = vr.r1;
if (style === undefined) {style = kHeaderDefault;} }
if (asc_typeof(end) !== "number") {
end = vr.r2;
}
if (style === undefined) {
style = kHeaderDefault;
}
this._setFont(drawingCtx, this.model.getDefaultFontName(), this.model.getDefaultFontSize()); this._setFont(drawingCtx, this.model.getDefaultFontName(), this.model.getDefaultFontSize());
var ctx = (drawingCtx) ? drawingCtx : this.drawingCtx;
var st = this.settings.header.style[style];
ctx.setFillStyle(st.border)
.fillRect(offsetX, -offsetY, this.headersWidth * 2, r[end].top - r[start].top);
// draw row headers // draw row headers
for (var i = start; i <= end; ++i) { for (var i = start; i <= end; ++i) {
this.__drawHeader(drawingCtx, offsetX, r[i].top - r[start].top - offsetY, this.__drawHeader(drawingCtx, offsetX, r[i].top - r[start].top - offsetY,
......
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