added initial capture popup UI, added ability to download capture

This commit is contained in:
Frank Noirot
2021-02-25 04:04:35 -05:00
parent 6e6425735f
commit 2ea8d5c2b5
5 changed files with 80 additions and 24 deletions

View File

@@ -75,14 +75,29 @@ const IdeCascadeStudio = ({ part, saveCode, loading }) => {
onCapture={ async () => {
// Get the canvas image as a Data URL
const imgBlob = await CascadeController.capture(threejsViewport.environment)
const imgURL = window.URL.createObjectURL(imgBlob)
// TODO: Upload the image to Cloudinary
// uploadToCloudinary(imgBlob)
// // Upload the image to Cloudinary
// const cloudinaryImg = await uploadToCloudinary(imgBlob)
// TODO: Save the screenshot as the mainImage if none has been set
// If it has been set, pass along the Blob without uploading
// onSave(part?.id, { ...input, mainImage: cloudinaryPublicId })
// // TODO: Save the screenshot as the mainImage if none has been set
// // If it has been set, pass along the Blob without uploading
// if (!part.mainImage) {
// saveCode({
// input: {
// code,
// title: part?.title,
// userId: currentUser?.sub,
// description: part?.description,
// mainImage: cloudinaryImg.public_id,
// },
// id: part.id,
// isFork: !canEdit,
// })
// } else {
// console.log('not saving, passing back into IDE', cloudinaryImg)
// }
return imgBlob
}}
/>
</div>