Skip to content

Commit

Permalink
fix: clear the previous sample after generation
Browse files Browse the repository at this point in the history
  • Loading branch information
qq15725 committed May 12, 2023
1 parent ca34910 commit 5523788
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/add-sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function addSample(
context2d.drawImage(img, 0, 0, canvas.width, canvas.height)
return addSample(
context,
context2d.getImageData(0, 0, img.width, img.height).data,
context2d.getImageData(0, 0, canvas.width, canvas.height).data,
options,
)
})
Expand Down
4 changes: 3 additions & 1 deletion src/create-palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export function createPalette(options?: Options | Context): Palette {

return result
},
generate(options) {
generate(options = {}) {
const { clearSamples = true } = options
if (clearSamples) previousSample = null
generate(context, options)
return this
},
Expand Down

1 comment on commit 5523788

@vercel
Copy link

@vercel vercel bot commented on 5523788 May 12, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

modern-palette – ./

modern-palette-qq15725.vercel.app
modern-palette-git-main-qq15725.vercel.app
modern-palette.vercel.app

Please sign in to comment.