Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import { GModelRoot } from '@eclipse-glsp/graph';
import { Action, ComputedBoundsAction, MaybePromise } from '@eclipse-glsp/protocol';
import { Action, ComputedBoundsAction, LayoutOperation, MaybePromise } from '@eclipse-glsp/protocol';
import { inject, injectable } from 'inversify';
import { ActionHandler } from '../../actions/action-handler';
import { applyAlignment, applyElementAndBounds, applyRoute } from '../../utils/layout-util';
Expand All @@ -39,7 +39,10 @@
const model = this.modelState.root;
if (action.revision === model.revision) {
this.applyBounds(model, action);
return this.submissionHandler.submitModelDirectly();
return this.submissionHandler.submitModelDirectly(
undefined,
LayoutOperation.create([], { canvasBounds: action.canvasBounds, viewport: action.viewport })

Check failure on line 44 in packages/server/src/common/features/layout/computed-bounds-action-handler.ts

View workflow job for this annotation

GitHub Actions / Test

Property 'viewport' does not exist on type 'ComputedBoundsAction'.

Check failure on line 44 in packages/server/src/common/features/layout/computed-bounds-action-handler.ts

View workflow job for this annotation

GitHub Actions / Test

Property 'canvasBounds' does not exist on type 'ComputedBoundsAction'.

Check failure on line 44 in packages/server/src/common/features/layout/computed-bounds-action-handler.ts

View workflow job for this annotation

GitHub Actions / Lint

Property 'viewport' does not exist on type 'ComputedBoundsAction'.

Check failure on line 44 in packages/server/src/common/features/layout/computed-bounds-action-handler.ts

View workflow job for this annotation

GitHub Actions / Lint

Property 'canvasBounds' does not exist on type 'ComputedBoundsAction'.

Check failure on line 44 in packages/server/src/common/features/layout/computed-bounds-action-handler.ts

View workflow job for this annotation

GitHub Actions / Build

Property 'viewport' does not exist on type 'ComputedBoundsAction'.

Check failure on line 44 in packages/server/src/common/features/layout/computed-bounds-action-handler.ts

View workflow job for this annotation

GitHub Actions / Build

Property 'canvasBounds' does not exist on type 'ComputedBoundsAction'.
);
}

return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
Action,
DirtyStateChangeReason,
GModelRootSchema,
LayoutOperation,
MarkersReason,
MaybePromise,
RequestBoundsAction,
Expand Down Expand Up @@ -112,9 +113,10 @@ export class ModelSubmissionHandler {
* to the `ActionDispatcher`, or simply returned as the result of an `ActionHandler.execute()` method.
*
* @param reason The optional reason that caused the model update.
* @param layout The optional layout operation that carries the information for auto-layout.
* @returns A list of actions to be processed in order to submit the model.
*/
submitModel(reason?: DirtyStateChangeReason): MaybePromise<Action[]> {
submitModel(reason?: DirtyStateChangeReason, layout?: LayoutOperation): MaybePromise<Action[]> {
this.modelFactory.createModel();

const revision = this.requestModelAction ? 0 : this.modelState.root.revision! + 1;
Expand All @@ -124,7 +126,7 @@ export class ModelSubmissionHandler {
const root = this.serializeGModel();
return [RequestBoundsAction.create(root), SetDirtyStateAction.create(this.commandStack.isDirty, { reason })];
}
return this.submitModelDirectly(reason);
return this.submitModelDirectly(reason, layout);
}

/**
Expand All @@ -139,11 +141,12 @@ export class ModelSubmissionHandler {
* `ActionHandler.execute()` method.
*
* @param reason The optional reason that caused the model update.
* @param layout The optional layout operation that carries the information for auto-layout.
* @returns A list of actions to be processed in order to submit the model.
*/
async submitModelDirectly(reason?: DirtyStateChangeReason): Promise<Action[]> {
async submitModelDirectly(reason?: DirtyStateChangeReason, layout?: LayoutOperation): Promise<Action[]> {
if (this.diagramConfiguration.layoutKind === ServerLayoutKind.AUTOMATIC && this.layoutEngine) {
await this.layoutEngine.layout();
await this.layoutEngine.layout(layout);
}

const root = this.serializeGModel();
Expand Down
Loading