Skip to content

Commit

Permalink
Revert "feat: add scrollLeftTop for sheet snapshot (#2348)"
Browse files Browse the repository at this point in the history
This reverts commit 38d8003.
  • Loading branch information
lumixraku authored Jun 3, 2024
1 parent 38d8003 commit 7446ffc
Show file tree
Hide file tree
Showing 29 changed files with 236 additions and 420 deletions.
2 changes: 1 addition & 1 deletion packages/docs-ui/src/controllers/back-scroll.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class BackScrollController extends RxDisposable {
offsetX = left - boundRight + ANCHOR_WIDTH;
}

const config = viewportMain.transViewportScroll2ScrollValue(offsetX, offsetY);
const config = viewportMain.getBarScroll(offsetX, offsetY);
viewportMain.scrollBy(config);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class DocEditorBridgeController extends Disposable {
if (scrollBar == null) {
viewportMain && new ScrollBar(viewportMain, { enableHorizontal: false, barSize: 8 });
} else {
viewportMain?.resetCanvasSizeAndUpdateScrollBar();
viewportMain?.resetSizeAndScrollBar();
}
} else {
scrollBar = null;
Expand All @@ -132,7 +132,7 @@ export class DocEditorBridgeController extends Disposable {
if (scrollBar == null) {
viewportMain && new ScrollBar(viewportMain, { barSize: 8, enableVertical: false });
} else {
viewportMain?.resetCanvasSizeAndUpdateScrollBar();
viewportMain?.resetSizeAndScrollBar();
}
} else {
scrollBar = null;
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-ui/src/controllers/zoom.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class ZoomController extends Disposable {

const viewport = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
if (scrollToX !== Number.POSITIVE_INFINITY && viewport != null) {
const actualX = viewport.transViewportScroll2ScrollValue(scrollToX, 0).x;
const actualX = viewport.getBarScroll(scrollToX, 0).x;
viewport.scrollTo({
x: actualX,
});
Expand Down
6 changes: 2 additions & 4 deletions packages/engine-render/src/basics/scroll-xy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
* limitations under the License.
*/

import type { Viewport } from '../viewport';

export function getCurrentScrollXY(scrollTimer: any) {
const scene = scrollTimer.getScene();
const viewport = scrollTimer.getViewportByCoord(scene) as Viewport;
const viewport = scrollTimer.getViewportByCoord(scene);
const scrollX = 0;
const scrollY = 0;
if (!viewport) {
Expand All @@ -27,7 +25,7 @@ export function getCurrentScrollXY(scrollTimer: any) {
scrollY,
};
}
const actualScroll = viewport.transScroll2ViewportScrollValue(viewport.scrollX, viewport.scrollY);
const actualScroll = viewport.getActualScroll(viewport.scrollX, viewport.scrollY);
return {
scrollX: actualScroll.x,
scrollY: actualScroll.y,
Expand Down
20 changes: 10 additions & 10 deletions packages/engine-render/src/components/sheets/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ export enum ShowGridlinesState {
}

export enum SHEET_VIEWPORT_KEY {
VIEW_MAIN = 'sheetViewMain',
VIEW_MAIN_LEFT_TOP = 'sheetViewMainLeftTop',
VIEW_MAIN_TOP = 'sheetViewMainTop',
VIEW_MAIN_LEFT = 'sheetViewMainLeft',

VIEW_ROW_TOP = 'sheetViewRowTop',
VIEW_ROW_BOTTOM = 'sheetViewRowBottom',
VIEW_COLUMN_LEFT = 'sheetViewColumnLeft',
VIEW_COLUMN_RIGHT = 'sheetViewColumnRight',
VIEW_LEFT_TOP = 'sheetViewLeftTop',
VIEW_MAIN = 'viewMain',
VIEW_MAIN_LEFT_TOP = 'viewMainLeftTop',
VIEW_MAIN_TOP = 'viewMainTop',
VIEW_MAIN_LEFT = 'viewMainLeft',

VIEW_ROW_TOP = 'viewRowTop',
VIEW_ROW_BOTTOM = 'viewRowBottom',
VIEW_COLUMN_LEFT = 'viewColumnLeft',
VIEW_COLUMN_RIGHT = 'viewColumnRight',
VIEW_LEFT_TOP = 'viewLeftTop',
}

export interface IPaintForRefresh {
Expand Down
4 changes: 4 additions & 0 deletions packages/engine-render/src/components/sheets/spreadsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,10 @@ export class Spreadsheet extends SheetComponent {
const spreadsheetSkeleton = this.getSkeleton()!;
const { rowHeaderWidth, columnHeaderHeight } = spreadsheetSkeleton;
const { left, top, right, bottom } = cacheBound;
// left -= rowHeaderWidth;
// top -= columnHeaderHeight;
// right -= rowHeaderWidth;
// bottom -= columnHeaderHeight;
const findClosestHundred = (number: number) => {
const remainder = number % 100;
return number + (100 - remainder);
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-render/src/scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ export class Scene extends ThinScene {

this.transform = composeResult;
this.getViewports().forEach((vp: Viewport) => {
vp.resetCanvasSizeAndUpdateScrollBar();
vp.resetSizeAndScrollBar();
});
this.makeDirty(true);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-render/src/scroll-timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class ScrollTimer {
y,
});

const actualScroll = viewport?.transScroll2ViewportScrollValue(x, y);
const actualScroll = viewport?.getActualScroll(x, y);

this._scrollX = actualScroll?.x || 0;
this._scrollY = actualScroll?.y || 0;
Expand Down
Loading

0 comments on commit 7446ffc

Please sign in to comment.