Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with change bounds tool #361

Merged
merged 1 commit into from
Jun 17, 2024
Merged
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 @@ -43,8 +43,8 @@ import { ISelectionListener, SelectionService } from '../../../base/selection-se
import {
BoundsAwareModelElement,
ResizableModelElement,
SelectableBoundsAware,
calcElementAndRoutingPoints,
forEachElement,
getMatchingElements,
isNonRoutableSelectedMovableBoundsAware,
toElementAndBounds
Expand Down Expand Up @@ -251,17 +251,20 @@ export class ChangeBoundsListener extends DragAwareMouseListener implements ISel

protected handleMoveOnServer(target: GModelElement): Action[] {
const operations: Operation[] = [];
operations.push(...this.handleMoveElementsOnServer(target));
operations.push(...this.handleMoveRoutingPointsOnServer(target));
const elementToMove = this.getElementsToMove(target);
operations.push(...this.handleMoveElementsOnServer(elementToMove));
operations.push(...this.handleMoveRoutingPointsOnServer(elementToMove));
return operations.length > 0 ? [CompoundOperation.create(operations)] : [];
}

protected handleMoveElementsOnServer(target: GModelElement): Operation[] {
protected getElementsToMove(target: GModelElement): SelectableBoundsAware[] {
const selectedElements = getMatchingElements(target.index, isNonRoutableSelectedMovableBoundsAware);
const selectionSet: Set<BoundsAwareModelElement> = new Set(selectedElements);
const newBounds: ElementAndBounds[] = selectedElements
.filter(element => this.isValidMove(element, selectionSet))
.map(toElementAndBounds);
return selectedElements.filter(element => this.isValidMove(element, selectionSet));
}

protected handleMoveElementsOnServer(elementsToMove: SelectableBoundsAware[]): Operation[] {
const newBounds = elementsToMove.map(toElementAndBounds);
return newBounds.length > 0 ? [ChangeBoundsOperation.create(newBounds)] : [];
}

Expand All @@ -282,12 +285,12 @@ export class ChangeBoundsListener extends DragAwareMouseListener implements ISel
return false;
}

protected handleMoveRoutingPointsOnServer(target: GModelElement): Operation[] {
protected handleMoveRoutingPointsOnServer(elementsToMove: SelectableBoundsAware[]): Operation[] {
const newRoutingPoints: ElementAndRoutingPoints[] = [];
const routerRegistry = this.tool.edgeRouterRegistry;
if (routerRegistry) {
// If client routing is enabled -> delegate routing points of connected edges to server
forEachElement(target.index, isNonRoutableSelectedMovableBoundsAware, element => {
elementsToMove.forEach(element => {
if (element instanceof GConnectableElement) {
element.incomingEdges
.map(connectable => calcElementAndRoutingPoints(connectable, routerRegistry))
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/src/di/container-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function resolveContainerConfiguration(...containerConfigurations: Contai
}
});
if (duplicates.length > 0) {
const culprits = duplicates.map(m => m.featureId).join(', ');
const culprits = duplicates.map(m => m.featureId.toString()).join(', ');
throw new Error(`Could not resolve container configuration. Non-unique feature ids found in container configuration: ${culprits}`);
}
return modules;
Expand Down
Loading