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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(docs): update draw cursor and horizontal line (#4902)
Ran Luo5cd9523b75c8
diff --git a/packages/docs-ui/src/services/selection/doc-selection-render.service.ts b/packages/docs-ui/src/services/selection/doc-selection-render.service.tsindex 2c48ee6b6b..97c8dadd4b 100644--- a/packages/docs-ui/src/services/selection/doc-selection-render.service.ts+++ b/packages/docs-ui/src/services/selection/doc-selection-render.service.ts@@ -618,7 +618,7 @@ export class DocSelectionRenderService extends RxDisposable implements IRenderMo// Only set selection use highlight color.const style: ITextSelectionStyle = {- strokeWidth: 1.5,+ strokeWidth: 1,stroke: 'rgba(0, 0, 0, 0)',strokeActive: 'rgba(0, 0, 0, 1)',fill: `rgba(${r}, ${g}, ${b}, ${a ?? 0.3})`,diff --git a/packages/docs-ui/src/services/selection/text-range.ts b/packages/docs-ui/src/services/selection/text-range.tsindex a60dac067c..229d3dbe70 100644--- a/packages/docs-ui/src/services/selection/text-range.ts+++ b/packages/docs-ui/src/services/selection/text-range.ts@@ -17,7 +17,7 @@import type { ITextRange, Nullable } from '@univerjs/core';import type { Documents, DocumentSkeleton, IDocumentSkeletonGlyph, INodePosition, IPoint, ISuccinctDocRangeParam, ITextSelectionStyle, Scene } from '@univerjs/engine-render';import type { IDocRange } from './range-interface';-import { BooleanNumber, COLORS, DOC_RANGE_TYPE, RANGE_DIRECTION, Tools } from '@univerjs/core';+import { BooleanNumber, COLORS, DOC_RANGE_TYPE, generateRandomId, RANGE_DIRECTION, Tools } from '@univerjs/core';import { getColor, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, Rect, RegularPolygon } from '@univerjs/engine-render';import {compareNodePosition,@@ -469,11 +469,11 @@ export class TextRange implements IDocRange {return;}- const anchor = new Rect(TEXT_ANCHOR_KEY_PREFIX + Tools.generateRandomId(ID_LENGTH), {+ const anchor = new Rect(TEXT_ANCHOR_KEY_PREFIX + generateRandomId(ID_LENGTH), {left,top,height,- strokeWidth: this.style?.strokeWidth || 1.5,+ strokeWidth: this.style?.strokeWidth || 1,stroke: this.style?.strokeActive || getColor(COLORS.black, 1),evented: false,});diff --git a/packages/engine-render/src/components/docs/document.ts b/packages/engine-render/src/components/docs/document.tsindex 8a1c8d68f6..e7b63ae861 100644--- a/packages/engine-render/src/components/docs/document.ts+++ b/packages/engine-render/src/components/docs/document.ts@@ -573,6 +573,7 @@ export class Documents extends DocComponent {y += marginTop + top + line.lineHeight + (line.borderBottom?.padding ?? 0);ctx.save();+ ctx.setLineWidthByPrecision(1);ctx.strokeStyle = line.borderBottom?.color.rgb ?? '#CDD0D8';drawLineByBorderType(ctx, BORDER_LTRB.BOTTOM, 0, {startX: x,