Fix native STL Blob Preview (#260)

* Fix existing STL Preview tab

* Add linux snapshots (height 500 and new stl one)

* Add comment
This commit is contained in:
Pierre Jacquier
2023-06-28 05:23:28 -04:00
committed by GitHub
parent dac539535a
commit e6daf99921
5 changed files with 30 additions and 2 deletions

View File

@ -45,6 +45,19 @@ function CadBlobPortal({
)
}
const isPreviewAlreadyEnabled =
existingToggle && existingToggle.childElementCount > 2 // Preview, Code, Blame
if (isPreviewAlreadyEnabled) {
const existingPreview = element.querySelector<HTMLElement>('iframe')
blob = existingPreview?.parentElement
if (blob && blob.parentElement) {
setBlobContainer(blob.parentElement)
blob.style.display = 'none'
}
// No toolbar, no sourceElements. Only a replacement of the existing (STL) preview
return
}
if (toolbar != null) {
setToolbarContainer(toolbar)
if (existingToggle) {
@ -110,7 +123,12 @@ function CadBlobPortal({
)}
{blobContainer &&
createPortal(
<Box sx={{ display: richSelected ? 'block' : 'none' }}>
<Box
sx={{
display: richSelected ? 'block' : 'none',
width: '100%',
}}
>
{richBlob ? (
<CadBlob blob={richBlob.blob} />
) : (