Skip to content

Commit

Permalink
Fix issue with change bounds tool
Browse files Browse the repository at this point in the history
- Ensure that the change bounds tool does not dispatch `ChangeRoutingPointsAction` if there are not valid element moves.
- Ensure that duplicate detection in `resolveContainerConfiguration` properly stringifies symboles.
  • Loading branch information
tortmayr committed Jun 17, 2024
1 parent 062e335 commit f05ea8b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
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

0 comments on commit f05ea8b

Please sign in to comment.