Skip to content

Commit

Permalink
Merge pull request #1536 from privy-open-source/release/1.0.0
Browse files Browse the repository at this point in the history
feat(core): expose `usePsPDF`, `loadFont`, and `createCanvas`
  • Loading branch information
adenvt authored Dec 6, 2024
2 parents dc4df03 + 2398526 commit 3243af7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/pdf-text/utils/text-to-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default async function generate (options: GenerateOptions, dpi = 1) {
context.fillStyle = labelColor

for (const line of labelLines) {
context.fillText(line, padding, y)
context.fillText(line, padding, y, maxWidth)

y += (labelSize * lineHeight)
}
Expand Down Expand Up @@ -211,7 +211,7 @@ export default async function generate (options: GenerateOptions, dpi = 1) {
context.fillStyle = color

for (const line of lines) {
context.fillText(line, padding, y)
context.fillText(line, padding, y, maxWidth)

y += (fontSize * lineHeight)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/signature-draw/utils/smooth-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ export class SmoothLine {
* @param length
*/
export function createLines (length: number): SmoothLine[] {
return Array.from({ length }).map((_, i) => new SmoothLine(i / (length * 1.25)))
return Array.from({ length }, (_, i) => new SmoothLine(i / (length * 1.25)))
}
12 changes: 12 additions & 0 deletions src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,15 @@ export {
export {
useTableQuery,
} from '../components/table-static'

export {
usePspdf,
} from '../components/pspdfkit'

export {
default as loadFont,
} from '../components/signature-text/utils/load-font'

export {
createCanvas,
} from '../components/signature-draw/utils/canvas'

0 comments on commit 3243af7

Please sign in to comment.