Skip to content

Commit

Permalink
fix: fix isRenderManagerService
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhudev committed Apr 21, 2024
1 parent 8f3835a commit 6a183e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/docs-ui/src/views/doc-canvas-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class DocCanvasView extends RxDisposable {
readonly fps$ = this._fps$.asObservable();

constructor(
@IRenderManagerService private readonly _renderManagerService: RenderManagerService,
@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,
@IConfigService private readonly _configService: IConfigService,
@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,
@IEditorService private readonly _editorService: IEditorService
Expand Down
6 changes: 4 additions & 2 deletions packages/engine-render/src/render-manager/render-unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import type { Scene } from '../scene';
import type { RenderComponentType } from './render-manager.service';

export interface IRender {
readonly isRenderUnit: true;

unitId: string;
engine: Engine;
scene: Scene;
Expand All @@ -37,7 +39,7 @@ export interface IRenderController extends IDisposable {}
/**
* This object encapsulates methods or properties to render each element.
*/
export interface IRenderContext<T extends UnitModel = UnitModel> extends IRender {
export interface IRenderContext<T extends UnitModel = UnitModel> extends Omit<IRender, 'isRenderUnit'> {
unit: T;
type: UnitType;
}
Expand All @@ -46,7 +48,7 @@ export interface IRenderContext<T extends UnitModel = UnitModel> extends IRender
* This class is responsible
*/
export class RenderUnit extends Disposable implements IRender {
// These declared fields would be assigned right after it is instantiated in `RenderManagerService.createRender`.
readonly isRenderUnit: true;

readonly unitId: string;
readonly type: UnitType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface ISheetObjectParam {
}

function isRenderManagerService(renderManagerService: IRenderManagerService | IRenderContext): renderManagerService is IRenderManagerService {
return !!(renderManagerService as any).defaultEngine;
return typeof (renderManagerService as IRenderContext).isMainScene !== 'undefined';
}

export function getSheetObject(
Expand Down

0 comments on commit 6a183e5

Please sign in to comment.