-
Notifications
You must be signed in to change notification settings - Fork 33
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
[FEAT] Render all Cancel Events #789
[FEAT] Render all Cancel Events #789
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Litlle suggestions to simply the code, and 1 to align the cross correctly 😄
private static drawCrossIcon(canvas: BpmnCanvas, thickness: number, roundedEdge: boolean): void { | ||
canvas.begin(); | ||
canvas.moveTo(0.5 - thickness, 0); | ||
roundedEdge ? canvas.arcTo(0.5, 0.5, 0, 0, 1, 0.5 + thickness, 0) : canvas.lineTo(0.5 + thickness, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a comment in issue #654 with an examples with non-rounded endings, please, check it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We answered on the issue with @aibcmars :)
/** | ||
* This icon is used by `cancel events`. | ||
*/ | ||
public paintCancelCrossIcon({ c, ratioFromParent, setIconOrigin, shape, icon }: PaintParameter): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it's almost the same code as paintXCrossIcon(...)
, I suggest to keep only paintXCrossIcon(...)
and pass the thickness in the icon
parameter.
We need also to modify the method calling in gateway-shapes.ts to give isFilled: true
in the icon
parameter.
(paintParameter: PaintParameter) => | ||
this.iconPainter.paintCancelCrossIcon({ | ||
...paintParameter, | ||
setIconOrigin: (canvas: BpmnCanvas) => canvas.setIconOriginToShapeTopLeft(2, 8), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the size of the shape of the event are not the the same in the 2 files.
If it's the case, there is a problem with the positionning of the icon. We need to position it according to the size of the shape, not with a margin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
7d7ca1d
to
26c4593
Compare
|
||
IconPainter.drawCrossIcon(canvas); | ||
const rotationCenterX = shape.w / 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone change the ratioFromParent (the size of the icon from the size of the shape), we always want to rotate the icon with the same value.
Can you revert this change, please ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forget my previous comment.
I'm not sur to understand how it's works, but everthing is OK.
Thank you very much for having integrate my comments 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the calculation of coordinates of rotation center.
Previously it was hardcoded to 1/4th cause of initial size of icon (half-size of shape) => center of rotation was on 1/4th of shape, but must be proportional to the ratioFromParent.
BTW, the default ratioFromParent is equals to 0.25 ;)
this.iconPainter.paintXCrossIcon({ ...paintParameter, setIconOrigin: (canvas: BpmnCanvas) => canvas.setIconOriginToShapeTopLeftProportionally(4) }); | ||
this.iconPainter.paintXCrossIcon({ | ||
...paintParameter, | ||
icon: { ...paintParameter.icon, isFilled: true }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[FEAT] Render cancel events
closes #654