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

chore(): Path remove unused code from path render function #9619

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [next]

- chore(): removed unused code from Path render function [#9619](https://github.com/fabricjs/fabric.js/pull/9619)

## [6.0.0-beta18]

- fix(StyledText): add ability to unset style (issue #9578) [#9597](https://github.com/fabricjs/fabric.js/pull/9597)
Expand Down
34 changes: 6 additions & 28 deletions src/shapes/Path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ export class Path<
* @param {CanvasRenderingContext2D} ctx context to render path on
*/
_renderPathCommands(ctx: CanvasRenderingContext2D) {
let subpathStartX = 0,
subpathStartY = 0,
x = 0, // current x
y = 0, // current y
controlX = 0, // current control point x
controlY = 0; // current control point y
const l = -this.pathOffset.x,
t = -this.pathOffset.y;

Expand All @@ -127,31 +121,21 @@ export class Path<
command[0] // first letter
) {
case 'L': // lineto, absolute
x = command[1];
y = command[2];
ctx.lineTo(x + l, y + t);
ctx.lineTo(command[1] + l, command[2] + t);
break;

case 'M': // moveTo, absolute
x = command[1];
y = command[2];
subpathStartX = x;
subpathStartY = y;
ctx.moveTo(x + l, y + t);
ctx.moveTo(command[1] + l, command[2] + t);
break;

case 'C': // bezierCurveTo, absolute
x = command[5];
y = command[6];
controlX = command[3];
controlY = command[4];
ctx.bezierCurveTo(
command[1] + l,
command[2] + t,
controlX + l,
controlY + t,
x + l,
y + t
command[3] + l,
command[4] + t,
command[5] + l,
command[6] + t
);
break;

Expand All @@ -162,15 +146,9 @@ export class Path<
command[3] + l,
command[4] + t
);
x = command[3];
y = command[4];
controlX = command[1];
controlY = command[2];
break;

case 'Z':
x = subpathStartX;
y = subpathStartY;
ctx.closePath();
break;
}
Expand Down
Loading