Skip to content

Measured Ports not updating #644

@ninjapiratica

Description

@ninjapiratica

We have a custom node that we are rendering the ports on either the top/bottom or left/right. We have a button that toggles the direction and we rerun the formatting (elk.js). When it reformats, the nodes shows up in the correctly expected location, however the measuredPorts are still in the original positions. That ends up putting the edges in weird places. We have found that modifying the size of the port will force them to be re-measured and properly rerender. The images attached are without the ngStyle change.

Is there a better way of getting these ports to be re-measured?

<mat-card class="scenario-node"
  [class.scenario-node-selected]="node().selected"
  [class.scenario-node-invalid]="node().data.invalid"
  [class.scenario-node-start]="node().data.isStart">
  @if (node().data.showIn){
  <ng-diagram-port
    id="port-in"
    type="target"
+    [ngStyle]="{ width : node().data.layoutDirection === 'RIGHT' ? '1px' : '2px' }"
    [side]="node().data.layoutDirection === 'RIGHT' ? 'left' : 'top'" />
  }

  <div class="scenario-node-status">
    @if (node().data.invalid) {
      <mat-icon>error</mat-icon>
    }
  </div>

  @if (node().data.isStart) {
    <div class="scenario-node-start-badge">{{ 'START' | translate }}</div>
  }

  <mat-card-subtitle>
    {{ node().data.title }}
  </mat-card-subtitle>

  @if (node().data.showOut) {
  <ng-diagram-port
    id="port-out"
    type="source"
+    [ngStyle]="{ width: node().data.layoutDirection === 'RIGHT' ? '1px' : '2px' }"
    [side]="node().data.layoutDirection === 'RIGHT' ? 'right' : 'bottom'" />
  }
</mat-card>

Post-switch direction
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions