Skip to content

Commit

Permalink
[fix] Fix rounding issue when converting ELK to GMF
Browse files Browse the repository at this point in the history
Before this fix, "10.83333333333334" from ELK side is considered as "10"
on GMF side, instead of "11".

Change-Id: I255c421b943636bb9d00cdd3aa9847ea47a185fc
  • Loading branch information
lredor committed Feb 7, 2025
1 parent d1444fe commit 84bb95c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, fina
for (ShapeLayoutData shapeLayout : shapeLayouts) {
// set new location of the element
if (shapeLayout.location != null) {
ViewUtil.setStructuralFeatureValue(shapeLayout.view, NotationPackage.eINSTANCE.getLocation_X(), Integer.valueOf(shapeLayout.location.x));
ViewUtil.setStructuralFeatureValue(shapeLayout.view, NotationPackage.eINSTANCE.getLocation_Y(), Integer.valueOf(shapeLayout.location.y));
ViewUtil.setStructuralFeatureValue(shapeLayout.view, NotationPackage.eINSTANCE.getLocation_X(), Math.toIntExact(Math.round(shapeLayout.location.preciseX())));
ViewUtil.setStructuralFeatureValue(shapeLayout.view, NotationPackage.eINSTANCE.getLocation_Y(), Math.toIntExact(Math.round(shapeLayout.location.preciseY())));
}
// set new size of the element
if (shapeLayout.size != null) {
ViewUtil.setStructuralFeatureValue(shapeLayout.view, NotationPackage.eINSTANCE.getSize_Width(), Integer.valueOf(shapeLayout.size.width));
ViewUtil.setStructuralFeatureValue(shapeLayout.view, NotationPackage.eINSTANCE.getSize_Height(), Integer.valueOf(shapeLayout.size.height));
ViewUtil.setStructuralFeatureValue(shapeLayout.view, NotationPackage.eINSTANCE.getSize_Width(), Math.toIntExact(Math.round(shapeLayout.size.preciseWidth())));
ViewUtil.setStructuralFeatureValue(shapeLayout.view, NotationPackage.eINSTANCE.getSize_Height(), Math.toIntExact(Math.round(shapeLayout.size.preciseHeight())));
}
}
shapeLayouts.clear();
Expand Down

0 comments on commit 84bb95c

Please sign in to comment.