Fixed code block output port alignment issue #5123
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request represents a rebased version of the same work that has already been reviewed, it will be easier to cross-merge to release branch if this needs to be taken in for 0.8.2.
Purpose
This pull request is meant to fix a problem where output ports of a code block node do not completely lined up with their corresponding statements. The defect is being tracked internally as:
This problem is introduced by slight offset accumulated along the way as output ports are placed in their container
ItemsControl. This accumulative error is unavoidable as onedoublevalue counts on another previousdoublevalue.To address this problem, instead of having the default
StackPanel(inside anItemsControl) arranging each output port, we now make use of a newPanelderived class:InOutPortPanel. This panel is aware of eachPortViewModel(and indirectly,PortModelandPortData) object it contains so it is capable of arranging the ports accurately.In order not to lose any precision, the vertical offset values are no longer computed in an accumulative way:
Instead, a new property
PortModel.LineIndex(replacingPortModel.VerticalMarginproperty) is introduced for lossless offset computation. The value ofPortModel.LineIndexis assigned whenCodeBlockNodeModelgenerates its output ports (i.e. when it has the knowledge of statement indices too). Error on a port does not get carried over for calculating offset of the next port:This is how it looks after the fix:

### DeclarationsCheck these if you believe they are true
*.resxfilesReviewers
Hi @aparajit-pratap, since you were previously dealing with this, please take a look. Thanks!
FYIs
@riteshchandawar, it's done!