Skip to content
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

Change borderCapStyle and borderJoinStyle defaults to be compatible with SKIA canvas #939

Merged
merged 8 commits into from
Sep 25, 2024

Conversation

mlohbihler
Copy link
Contributor

Setting these defaults prevents errors when using annotations in the skia canvas context. See Issue for more details: #938

LeeLenaleee
LeeLenaleee previously approved these changes Aug 22, 2024
@LeeLenaleee
Copy link
Collaborator

Change LGTM, but it seems the CI fails

@mlohbihler
Copy link
Contributor Author

mlohbihler commented Aug 22, 2024

Change LGTM, but it seems the CI fails

I'll have a look.

@mlohbihler
Copy link
Contributor Author

mlohbihler commented Aug 23, 2024

I think i need help with this. test-integration works locally for me, but i'm on mac. Not sure why it would be failing on ubuntu.

Edit: Actually, it looks like test-integration succeeded, but then the process failed with no further messages.

@mlohbihler
Copy link
Contributor Author

mlohbihler commented Aug 23, 2024

I think i need help with this. test-integration works locally for me, but i'm on mac. Not sure why it would be failing on ubuntu.

Edit: Actually, it looks like test-integration succeeded, but then the process failed with no further messages.

Actually, i'm getting the same build failure on the master branch. @LeeLenaleee can you check?

@LeeLenaleee
Copy link
Collaborator

I will look into it this weekend

Copy link
Collaborator

@stockiNail stockiNail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mlohbihler @LeeLenaleee has written in the issue, we need to take care about options fallback.

As far as I remember, with this updates we are creating a breaking change because we are stopping the fallback of start and end config to arrowHeads configuration and not to the line options, as is today.

src/types/line.js Outdated Show resolved Hide resolved
src/types/line.js Outdated Show resolved Hide resolved
@mlohbihler mlohbihler force-pushed the lineCap-lineJoin branch 2 times, most recently from b42ea68 to 564277e Compare August 23, 2024 19:07
@stockiNail
Copy link
Collaborator

@mlohbihler LGTM. May be you can try the branch against SKIA canvas to check if it is working as expected.

@stockiNail
Copy link
Collaborator

stockiNail commented Sep 18, 2024

@mlohbihler the failed test has been fixed in #902. Therefore after merging of that and rebase this branch, we could re-run the failed job

@mlohbihler
Copy link
Contributor Author

@mlohbihler the failed test has been fixed in #902. Therefore after merging of that and rebase this branch, we could re-run the failed job

@stockiNail nice. Thanks for this.

@stockiNail
Copy link
Collaborator

@mlohbihler if you will rebase and push again, we can go on. Take your time. Thanks a lot!

@stockiNail stockiNail changed the title Fix defaults for skia canvas Change borderCapStyle and borderJoinStyle defaults to be compatible with SKIA canvas Sep 19, 2024
@stockiNail stockiNail added this to the 3.1.0 milestone Sep 19, 2024
@mlohbihler
Copy link
Contributor Author

@mlohbihler if you will rebase and push again, we can go on. Take your time. Thanks a lot!

Build checks are passing now, but i guess with the (net zero) playing around i did i lost my approval. Re-requested.

Copy link
Collaborator

@stockiNail stockiNail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologize if I hadn't time before to have a look.

The changes are adding options not used by those annotations therefore I would prefer to change only the setBorderStyle (reverting the current changes of PR) as following:

export function setBorderStyle(ctx, options) {
  if (options && options.borderWidth) {
    ctx.lineCap = options.borderCapStyle || 'butt';
    ctx.setLineDash(options.borderDash);
    ctx.lineDashOffset = options.borderDashOffset;
    ctx.lineJoin = options.borderJoinStyle  || 'miter';
    ctx.lineWidth = options.borderWidth;
    ctx.strokeStyle = options.borderColor;
    return true;
  }
}

Let me know what you think

@mlohbihler
Copy link
Contributor Author

Apologize if I hadn't time before to have a look.

The changes are adding options not used by those annotations therefore I would prefer to change only the setBorderStyle (reverting the current changes of PR) as following:

export function setBorderStyle(ctx, options) {
  if (options && options.borderWidth) {
    ctx.lineCap = options.borderCapStyle || 'butt';
    ctx.setLineDash(options.borderDash);
    ctx.lineDashOffset = options.borderDashOffset;
    ctx.lineJoin = options.borderJoinStyle  || 'miter';
    ctx.lineWidth = options.borderWidth;
    ctx.strokeStyle = options.borderColor;
    return true;
  }
}

Let me know what you think

That change seems to work for me. Note that there are other instances of these properties getting set. Not sure if they can be removed too. E.g. see https://github.com/mlohbihler/chartjs-plugin-annotation/blob/0bce23d13a8db9aa9c58a80e5fc2929b4dfbab71/src/types/box.js#L40

@stockiNail
Copy link
Collaborator

That change seems to work for me. Note that there are other instances of these properties getting set. Not sure if they can be removed too. E.g. see https://github.com/mlohbihler/chartjs-plugin-annotation/blob/0bce23d13a8db9aa9c58a80e5fc2929b4dfbab71/src/types/box.js#L40

@mlohbihler the joinStyle and capstyle are used for setting on canvas only in the point that you have changed.
The other istances are only in the options defintions of the annotations in order to enable the options settings from the user.

@stockiNail stockiNail merged commit 8bd8a3e into chartjs:master Sep 25, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants