Skip to content

Commit

Permalink
fix(drawing): set drawing bounding in left/top to A1 cell
Browse files Browse the repository at this point in the history
  • Loading branch information
VicKun4937 committed Nov 18, 2024
1 parent 9630498 commit 75010ff
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export abstract class SheetComponent extends RenderComponent<SpreadsheetSkeleton

updateSkeleton(spreadsheetSkeleton: SpreadsheetSkeleton) {
this._skeleton = spreadsheetSkeleton;
this.getScene()?.updateTransformerZero(spreadsheetSkeleton.rowHeaderWidth, spreadsheetSkeleton.columnHeaderHeight);
}

override render(mainCtx: UniverRenderingContext, bounds?: IViewportInfo) {
Expand Down
2 changes: 2 additions & 0 deletions packages/engine-render/src/components/sheets/spreadsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ export class Spreadsheet extends SheetComponent {
const { rowHeaderWidth, columnHeaderHeight } = spreadsheetSkeleton;
mainCtx.translateWithPrecision(rowHeaderWidth, columnHeaderHeight);

this.getScene()?.updateTransformerZero(spreadsheetSkeleton.rowHeaderWidth, spreadsheetSkeleton.columnHeaderHeight);

const { viewportKey } = viewportInfo;
// scene --> layer, getObjects --> viewport.render(object) --> spreadsheet
// SHEET_COMPONENT_MAIN_LAYER_INDEX = 0;
Expand Down
5 changes: 5 additions & 0 deletions packages/engine-render/src/scene.transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ export class Transformer extends Disposable implements ITransformerConfig {
super();
this._initialProps(config);
}

Check failure on line 210 in packages/engine-render/src/scene.transformer.ts

View workflow job for this annotation

GitHub Actions / eslint

Trailing spaces not allowed
updateZeroPoint(left: number, top: number) {
this.zeroLeft = left;
this.zeroTop = top;
}

changeNotification() {
this._changing$.next({
Expand Down
4 changes: 4 additions & 0 deletions packages/engine-render/src/scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,10 @@ export class Scene extends ThinScene {
return this._transformer;
}

updateTransformerZero(left: number, top: number) {
this._transformer?.updateZeroPoint(left, top);
}

/**
* prev getActiveViewportByRelativeCoord
* @param coord
Expand Down

0 comments on commit 75010ff

Please sign in to comment.