@univerjs/engine-render 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,11 +21,11 @@ export declare abstract class DocComponent extends RenderComponent<IDocumentSkel
21
21
  getSkeleton(): DocumentSkeleton | undefined;
22
22
  setSkeleton(skeleton: DocumentSkeleton): void;
23
23
  private _setConfig;
24
- render(mainCtx: UniverRenderingContext, bounds?: IViewportInfo): this | undefined;
24
+ render(mainCtx: UniverRenderingContext, bounds?: Partial<IViewportInfo>): this | undefined;
25
25
  getParentScale(): {
26
26
  scaleX: any;
27
27
  scaleY: any;
28
28
  };
29
29
  isSkipByDiffBounds(page: IDocumentSkeletonPage, pageTop: number, pageLeft: number, bounds?: IViewportInfo): boolean;
30
- protected abstract _draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
30
+ protected abstract _draw(ctx: UniverRenderingContext, bounds?: Partial<IViewportInfo>): void;
31
31
  }
@@ -1,12 +1,24 @@
1
1
  import { IScale } from '@univerjs/core';
2
+ import { IBoundRectNoAngle } from '../../../basics';
2
3
  import { IDocumentSkeletonGlyph } from '../../../basics/i-document-skeleton-cached';
3
4
  import { UniverRenderingContext } from '../../../context';
5
+ import { IDrawInfo } from '../../extension';
4
6
  import { docExtension } from '../doc-extension';
7
+ /**
8
+ * Singleton
9
+ */
5
10
  export declare class FontAndBaseLine extends docExtension {
6
11
  uKey: string;
7
12
  Z_INDEX: number;
8
13
  private _preFontColor;
9
- draw(ctx: UniverRenderingContext, parentScale: IScale, glyph: IDocumentSkeletonGlyph): void;
14
+ /**
15
+ * ctx.font = val; then ctx.font is not exactly the same as val
16
+ * that is because canvas would normalize the font string, remove default value and convert pt to px.
17
+ * so we need a map to store actual value and set value
18
+ */
19
+ actualFontMap: Record<string, string>;
20
+ constructor();
21
+ draw(ctx: UniverRenderingContext, _parentScale: IScale, glyph: IDocumentSkeletonGlyph, _?: IBoundRectNoAngle, more?: IDrawInfo): void;
10
22
  private _fillText;
11
23
  clearCache(): void;
12
24
  }
@@ -42,6 +42,12 @@ export declare class FontCache {
42
42
  sbo: number;
43
43
  spo: number;
44
44
  };
45
+ /**
46
+ * Measure text on another canvas.
47
+ * @param content
48
+ * @param fontString
49
+ * @returns IMeasureTextCache
50
+ */
45
51
  static getMeasureText(content: string, fontString: string): IMeasureTextCache;
46
52
  private static _clearMeasureCache;
47
53
  /**
@@ -25,7 +25,7 @@ export declare class ComponentExtension<T, U, V> {
25
25
  translateY: number;
26
26
  extensionOffset: IExtensionConfig;
27
27
  get zIndex(): number;
28
- draw(ctx: UniverRenderingContext, parentScale: IScale, skeleton: T, diffBounds?: V, more?: IDrawInfo): void;
28
+ draw(_ctx: UniverRenderingContext, _parentScale: IScale, _skeleton: T, _diff?: V, _more?: IDrawInfo): void;
29
29
  clearCache(): void;
30
30
  protected _getScale(parentScale: IScale): number;
31
31
  dispose(): void;
@@ -7,9 +7,7 @@ import { SheetExtension } from './sheet-extension';
7
7
  interface IRenderFontContext {
8
8
  ctx: UniverRenderingContext;
9
9
  scale: number;
10
- rowHeightAccumulation: number[];
11
10
  columnTotalWidth: number;
12
- columnWidthAccumulation: number[];
13
11
  rowTotalHeight: number;
14
12
  viewRanges: IRange[];
15
13
  checkOutOfViewBound: boolean;
@@ -20,9 +18,21 @@ interface IRenderFontContext {
20
18
  * includes documentSkeleton & cellData
21
19
  */
22
20
  fontCache?: Nullable<IFontCacheItem>;
21
+ /**
22
+ * cell rect startY(with merge info)
23
+ */
23
24
  startY: number;
25
+ /**
26
+ * cell rect endY (with merge info)
27
+ */
24
28
  endY: number;
29
+ /**
30
+ * cell rect startX(with merge info)
31
+ */
25
32
  startX: number;
33
+ /**
34
+ * cell rect endX (with merge info)
35
+ */
26
36
  endX: number;
27
37
  cellInfo: ICellWithCoord;
28
38
  }
@@ -40,7 +50,7 @@ export declare class Font extends SheetExtension {
40
50
  * @param col
41
51
  * @param fontCache
42
52
  */
43
- private _setFontRenderBounds;
53
+ private _clipByRenderBounds;
44
54
  private _renderDocuments;
45
55
  private _clipRectangleForOverflow;
46
56
  }
@@ -216,6 +216,7 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
216
216
  * Any changes to sheet model would reset cache.
217
217
  */
218
218
  _resetCache(): void;
219
+ resetRangeCache(ranges: IRange[]): void;
219
220
  _setBorderStylesCache(row: number, col: number, style: Nullable<IStyleData>, options: {
220
221
  mergeRange?: IRange;
221
222
  cacheItem?: ICacheItem;
@@ -48,6 +48,7 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
48
48
  get direction(): CanvasDirection;
49
49
  set direction(val: CanvasDirection);
50
50
  get font(): string;
51
+ _normalizedCachedFont: string;
51
52
  set font(val: string);
52
53
  get fontKerning(): CanvasFontKerning;
53
54
  set fontKerning(val: CanvasFontKerning);