Skip to content

Commit

Permalink
Make lineCap prop optional (#460)
Browse files Browse the repository at this point in the history
* Make lineCap prop optional

* Update tests

* Cleanup
  • Loading branch information
Hopding authored May 25, 2020
1 parent 216d9e7 commit 3256473
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
8 changes: 7 additions & 1 deletion apps/deno/tests/test3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,19 @@ export default async (assets: Assets) => {
end: { x: 30 + lastPageTextWidth, y: 205 },
color: hotPink,
thickness: 5,
lineCap: LineCapStyle.Round,
});
page2.drawImage(cmykImage, {
...cmykDims,
x: 30,
y: 30,
});
page2.drawLine({
start: { x: 30, y: 240 },
end: { x: 30 + lastPageTextWidth, y: 240 },
color: hotPink,
thickness: 5,
lineCap: LineCapStyle.Round,
});

console.log('Title:', pdfDoc.getTitle());
console.log('Author:', pdfDoc.getAuthor());
Expand Down
8 changes: 7 additions & 1 deletion apps/node/tests/test3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,19 @@ export default async (assets: Assets) => {
end: { x: 30 + lastPageTextWidth, y: 205 },
color: hotPink,
thickness: 5,
lineCap: LineCapStyle.Round,
});
page2.drawImage(cmykImage, {
...cmykDims,
x: 30,
y: 30,
});
page2.drawLine({
start: { x: 30, y: 240 },
end: { x: 30 + lastPageTextWidth, y: 240 },
color: hotPink,
thickness: 5,
lineCap: LineCapStyle.Round,
});

console.log('Title:', pdfDoc.getTitle());
console.log('Author:', pdfDoc.getAuthor());
Expand Down
8 changes: 7 additions & 1 deletion apps/rn/src/tests/test3.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,19 @@ export default async () => {
end: { x: 30 + lastPageTextWidth, y: 205 },
color: hotPink,
thickness: 5,
lineCap: LineCapStyle.Round,
});
page2.drawImage(cmykImage, {
...cmykDims,
x: 30,
y: 30,
});
page2.drawLine({
start: { x: 30, y: 240 },
end: { x: 30 + lastPageTextWidth, y: 240 },
color: hotPink,
thickness: 5,
lineCap: LineCapStyle.Round,
});

console.log('Title:', pdfDoc.getTitle());
console.log('Author:', pdfDoc.getAuthor());
Expand Down
8 changes: 7 additions & 1 deletion apps/web/test3.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,19 @@
end: { x: 30 + lastPageTextWidth, y: 205 },
color: hotPink,
thickness: 5,
lineCap: LineCapStyle.Round,
});
page2.drawImage(cmykImage, {
...cmykDims,
x: 30,
y: 30,
});
page2.drawLine({
start: { x: 30, y: 240 },
end: { x: 30 + lastPageTextWidth, y: 240 },
color: hotPink,
thickness: 5,
lineCap: LineCapStyle.Round,
});

console.log('Title:', pdfDoc.getTitle());
console.log('Author:', pdfDoc.getAuthor());
Expand Down
2 changes: 1 addition & 1 deletion src/api/PDFPageOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ export interface PDFPageDrawRectangleOptions {
export interface PDFPageDrawLineOptions {
start: { x: number; y: number };
end: { x: number; y: number };
lineCap: LineCapStyle | undefined;
thickness?: number;
color?: Color;
lineCap?: LineCapStyle;
}

export interface PDFPageDrawSquareOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/api/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ export const drawLine = (options: {
start: { x: number | PDFNumber; y: number | PDFNumber };
end: { x: number | PDFNumber; y: number | PDFNumber };
thickness: number | PDFNumber;
lineCap: LineCapStyle | undefined;
color: Color | undefined;
lineCap?: LineCapStyle;
}) =>
[
pushGraphicsState(),
Expand Down

0 comments on commit 3256473

Please sign in to comment.