Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(sheet): appearance adjustment (#441)

Univer76ec4ab78290
diff --git a/packages/base-render/src/components/sheets/extensions/column-header-layout.ts b/packages/base-render/src/components/sheets/extensions/column-header-layout.ts
index e25274522c..f07edbc25f 100644
--- a/packages/base-render/src/components/sheets/extensions/column-header-layout.ts
+++ b/packages/base-render/src/components/sheets/extensions/column-header-layout.ts
@@ -1,6 +1,6 @@
import { IScale, numberToABC } from '@univerjs/core';
-import { MIDDLE_CELL_POS_MAGIC_NUMBER } from '../../../basics/const';
+import { DEFAULT_FONTFACE_PLANE, MIDDLE_CELL_POS_MAGIC_NUMBER } from '../../../basics/const';
import { fixLineWidthByScale, getColor } from '../../../basics/tools';
import { SheetColumnHeaderExtensionRegistry } from '../../extension';
import { SpreadsheetSkeleton } from '../sheet-skeleton';
@@ -45,6 +45,7 @@ export class ColumnHeaderLayout extends SheetExtension {
ctx.beginPath();
ctx.lineWidth = 1 / scale;
ctx.strokeStyle = getColor([217, 217, 217])!;
+ ctx.font = `13px ${DEFAULT_FONTFACE_PLANE}`;
let preColumnPosition = 0;
const columnWidthAccumulationLength = columnWidthAccumulation.length;
for (let c = startColumn - 1; c <= endColumn; c++) {
@@ -54,7 +55,7 @@ export class ColumnHeaderLayout extends SheetExtension {
const columnEndPosition = fixLineWidthByScale(columnWidthAccumulation[c], scale);
if (preColumnPosition === columnEndPosition) {
- // 跳过隐藏行
+ // Skip hidden rows
continue;
}
@@ -64,7 +65,7 @@ export class ColumnHeaderLayout extends SheetExtension {
// painting column header text
const middleCellPos = preColumnPosition + (columnEndPosition - preColumnPosition) / 2;
- ctx.fillText(numberToABC(c), middleCellPos, columnHeaderHeight / 2 + MIDDLE_CELL_POS_MAGIC_NUMBER); // 魔法数字1,因为垂直对齐看起来差1像素
+ ctx.fillText(numberToABC(c), middleCellPos, columnHeaderHeight / 2 + MIDDLE_CELL_POS_MAGIC_NUMBER); // Magic number 1, because the vertical alignment appears to be off by 1 pixel
preColumnPosition = columnEndPosition;
}
diff --git a/packages/base-render/src/components/sheets/extensions/row-header-layout.ts b/packages/base-render/src/components/sheets/extensions/row-header-layout.ts
index 3387009292..dfe682d2da 100644
--- a/packages/base-render/src/components/sheets/extensions/row-header-layout.ts
+++ b/packages/base-render/src/components/sheets/extensions/row-header-layout.ts
@@ -1,6 +1,6 @@
import { IScale } from '@univerjs/core';
-import { MIDDLE_CELL_POS_MAGIC_NUMBER } from '../../../basics/const';
+import { DEFAULT_FONTFACE_PLANE, MIDDLE_CELL_POS_MAGIC_NUMBER } from '../../../basics/const';
import { fixLineWidthByScale, getColor } from '../../../basics/tools';
import { SheetRowHeaderExtensionRegistry } from '../../extension';
import { SpreadsheetSkeleton } from '../sheet-skeleton';
@@ -35,12 +35,13 @@ export class RowHeaderLayout extends SheetExtension {
const scale = this._getScale(parentScale);
ctx.fillStyle = getColor([248, 249, 250])!;
ctx.fillRect(0, 0, rowHeaderWidth, rowTotalHeight);
- ctx.textAlign = 'center'; // 文字水平居中
- ctx.textBaseline = 'middle'; // 文字垂直居中
- ctx.fillStyle = getColor([0, 0, 0])!; // 文字颜色
+ ctx.textAlign = 'center';
+ ctx.textBaseline = 'middle';
+ ctx.fillStyle = getColor([0, 0, 0])!;
ctx.beginPath();
ctx.lineWidth = 1 / scale;
ctx.strokeStyle = getColor([217, 217, 217])!;
+ ctx.font = `13px ${DEFAULT_FONTFACE_PLANE}`;
let preRowPosition = 0;
const rowHeightAccumulationLength = rowHeightAccumulation.length;
for (let r = startRow - 1; r <= endRow; r++) {
@@ -49,14 +50,14 @@ export class RowHeaderLayout extends SheetExtension {
}
const rowEndPosition = fixLineWidthByScale(rowHeightAccumulation[r], scale);
if (preRowPosition === rowEndPosition) {
- // 跳过隐藏行
+ // Skip hidden rows
continue;
}
ctx.moveTo(0, rowEndPosition);
ctx.lineTo(rowHeaderWidth, rowEndPosition);
const middleCellPos = preRowPosition + (rowEndPosition - preRowPosition) / 2;
- ctx.fillText(`${r + 1}`, rowHeaderWidth / 2, middleCellPos + MIDDLE_CELL_POS_MAGIC_NUMBER); // 魔法数字1,因为垂直对齐看起来差1像素
+ ctx.fillText(`${r + 1}`, rowHeaderWidth / 2, middleCellPos + MIDDLE_CELL_POS_MAGIC_NUMBER); // Magic number 1, because the vertical alignment appears to be off by 1 pixel.
preRowPosition = rowEndPosition;
}
// console.log('xx2', rowColumnIndexRange, bounds, this._rowTotalHeight, this._rowHeightAccumulation);
diff --git a/packages/base-render/src/shape/scroll-bar.ts b/packages/base-render/src/shape/scroll-bar.ts
index 86236d63c7..6f58cd60d7 100644
--- a/packages/base-render/src/shape/scroll-bar.ts
+++ b/packages/base-render/src/shape/scroll-bar.ts
@@ -46,9 +46,9 @@ export class ScrollBar extends BaseScrollBar {
thumbActiveBackgroundColor = '#999999';
- barBackgroundColor = '#fff';
+ barBackgroundColor = 'rgba(255,255,255,0.5)';
- barBorderColor = '#fff';
+ barBorderColor = 'rgba(255,255,255,0.7)';
constructor(view: Viewport, props?: IScrollBarProps) {
super();
diff --git a/packages/base-ui/src/views/components/doc-bars/index.module.less b/packages/base-ui/src/views/components/doc-bars/index.module.less
index acc4b63490..4845e10ec1 100644
--- a/packages/base-ui/src/views/components/doc-bars/index.module.less
+++ b/packages/base-ui/src/views/components/doc-bars/index.module.less
@@ -95,6 +95,8 @@
border-radius: var(--border-radius-base);
+ font-size: var(--font-size-xl);
+
&:hover {
background-color: rgb(var(--grey-100));
border-radius: var(--border-radius-base);