diff --git a/packages/designer/src/designer/designer.ts b/packages/designer/src/designer/designer.ts index 118d068cf..999dc84a5 100644 --- a/packages/designer/src/designer/designer.ts +++ b/packages/designer/src/designer/designer.ts @@ -59,7 +59,7 @@ export interface DesignerProps { export class Designer implements IDesigner { - readonly dragon = new Dragon(this); + dragon: Dragon; readonly componentActions = new ComponentActions(); @@ -99,6 +99,7 @@ export class Designer implements IDesigner { this.project = new Project(this, props.defaultSchema, viewName); + this.dragon = new Dragon(this); this.dragon.onDragstart((e) => { this.detecting.enable = false; const { dragObject } = e; @@ -564,6 +565,10 @@ export class Designer implements IDesigner { } addPropsReducer(reducer: IPublicTypePropsTransducer, stage: IPublicEnumTransformStage) { + if (!reducer) { + logger.error('reducer is not available'); + return; + } const reducers = this.propsReducers.get(stage); if (reducers) { reducers.push(reducer); diff --git a/packages/shell/src/api/canvas.ts b/packages/shell/src/api/canvas.ts index 6c7040311..9e729467f 100644 --- a/packages/shell/src/api/canvas.ts +++ b/packages/shell/src/api/canvas.ts @@ -26,7 +26,7 @@ export class Canvas implements IPublicApiCanvas { return this[editorSymbol].get('designer') as IDesigner; } - constructor(editor: IPublicModelEditor) { + constructor(editor: IPublicModelEditor, readonly workspaceMode: boolean = false) { this[editorSymbol] = editor; } @@ -49,7 +49,7 @@ export class Canvas implements IPublicApiCanvas { } get dragon(): IPublicModelDragon | null { - return Dragon.create(this[designerSymbol].dragon); + return Dragon.create(this[designerSymbol].dragon, this.workspaceMode); } get activeTracker(): IPublicModelActiveTracker | null { diff --git a/packages/shell/src/model/dragon.ts b/packages/shell/src/model/dragon.ts index 38fa6323e..cc3f7a0f1 100644 --- a/packages/shell/src/model/dragon.ts +++ b/packages/shell/src/model/dragon.ts @@ -19,11 +19,14 @@ export const innerDragonSymbol = Symbol('innerDragonSymbol'); export class Dragon implements IPublicModelDragon { private readonly [innerDragonSymbol]: IPublicModelDragon; - constructor(innerDragon: IPublicModelDragon) { + constructor(innerDragon: IPublicModelDragon, readonly workspaceMode: boolean) { this[innerDragonSymbol] = innerDragon; } get [dragonSymbol](): any { + if (this.workspaceMode) { + return this[innerDragonSymbol]; + } const workspace = globalContext.get('workspace'); let editor = globalContext.get('editor'); @@ -35,11 +38,11 @@ export class Dragon implements IPublicModelDragon { return designer.dragon; } - static create(dragon: IPublicModelDragon | null): IPublicModelDragon | null { + static create(dragon: IPublicModelDragon | null, workspaceMode: boolean): IPublicModelDragon | null { if (!dragon) { return null; } - return new Dragon(dragon); + return new Dragon(dragon, workspaceMode); } /** diff --git a/packages/workspace/src/base-context.ts b/packages/workspace/src/base-context.ts index 8ab26e455..0ff63ee02 100644 --- a/packages/workspace/src/base-context.ts +++ b/packages/workspace/src/base-context.ts @@ -81,7 +81,7 @@ export class BasicContext { const event = new Event(commonEvent, { prefix: 'common' }); const logger = getLogger({ level: 'warn', bizName: 'common' }); const skeleton = new Skeleton(innerSkeleton, 'any', true); - const canvas = new Canvas(editor); + const canvas = new Canvas(editor, true); editor.set('setters', setters); editor.set('project', project); editor.set('material', material); diff --git a/packages/workspace/src/layouts/workbench.less b/packages/workspace/src/layouts/workbench.less index 0639a1fa1..95574871a 100644 --- a/packages/workspace/src/layouts/workbench.less +++ b/packages/workspace/src/layouts/workbench.less @@ -153,6 +153,7 @@ body { .lc-top-area-left, .lc-sub-top-area-left { display: flex; align-items: center; + max-width: 100%; } .lc-top-area-center, .lc-sub-top-area-center { @@ -361,6 +362,18 @@ body { } } + .lc-workspace-workbench-center-content { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + } + + .engine-actionitem { + max-width: 100%; + } + .lc-workspace-workbench-window { position: relative; height: 100%; diff --git a/packages/workspace/src/layouts/workbench.tsx b/packages/workspace/src/layouts/workbench.tsx index 66ddb7de0..7ffb0e531 100644 --- a/packages/workspace/src/layouts/workbench.tsx +++ b/packages/workspace/src/layouts/workbench.tsx @@ -41,7 +41,7 @@ export class Workbench extends Component<{
- <> +
{ @@ -54,7 +54,7 @@ export class Workbench extends Component<{ )) }
- +
diff --git a/packages/workspace/src/workspace.ts b/packages/workspace/src/workspace.ts index 8256ee9f5..05d2e666a 100644 --- a/packages/workspace/src/workspace.ts +++ b/packages/workspace/src/workspace.ts @@ -101,7 +101,7 @@ export class Workspace implements IPublicApiWorkspace { private remove(index: number) { const window = this.windows[index]; - this.windows = this.windows.splice(index - 1, 1); + this.windows.splice(index, 1); if (this.window === window) { this.window = this.windows[index] || this.windows[index + 1] || this.windows[index - 1]; this.emitChangeActiveWindow();