mirror of
https://github.com/yeicor-3d/yet-another-cad-viewer.git
synced 2025-12-19 14:14:13 +01:00
Fix typescript 5.9 errors and minor improvements
This commit is contained in:
@@ -99,7 +99,7 @@ export class SceneMgr {
|
||||
let transform = (new Matrix4()).makeTranslation(bb.getCenter(new Vector3()));
|
||||
newAxes(helpersDoc, bb.getSize(new Vector3()).multiplyScalar(0.5), transform);
|
||||
newGridBox(helpersDoc, bb.getSize(new Vector3()), transform);
|
||||
let helpersUrl = URL.createObjectURL(new Blob([await toBuffer(helpersDoc)]));
|
||||
let helpersUrl = URL.createObjectURL(new Blob([await toBuffer(helpersDoc) as ArrayBufferView<ArrayBuffer>]));
|
||||
let newDocument = await SceneMgr.loadModel(sceneUrl, document, extrasNameValueHelpers, helpersUrl, false, reloadScene);
|
||||
URL.revokeObjectURL(helpersUrl);
|
||||
return newDocument;
|
||||
@@ -112,7 +112,7 @@ export class SceneMgr {
|
||||
|
||||
// Serialize the document into a GLB and update the viewerSrc
|
||||
let buffer = await toBuffer(document);
|
||||
let blob = new Blob([buffer], {type: 'model/gltf-binary'});
|
||||
let blob = new Blob([buffer as ArrayBufferView<ArrayBuffer>], {type: 'model/gltf-binary'});
|
||||
console.debug("Showing current doc", document, "with", buffer.length, "total bytes");
|
||||
if (sceneUrl.value.startsWith("blob:")) URL.revokeObjectURL(sceneUrl.value);
|
||||
sceneUrl.value = URL.createObjectURL(blob);
|
||||
|
||||
@@ -145,7 +145,7 @@ function onModelData(modelData: string) {
|
||||
// - Save for upload and share link feature
|
||||
builtModelsGlb[modelMetadata.name] = binaryData;
|
||||
// - Create a Blob from the binary data to be used as a URL
|
||||
const blob = new Blob([binaryData], {type: 'model/gltf-binary'});
|
||||
const blob = new Blob([binaryData as ArrayBufferView<ArrayBuffer>], {type: 'model/gltf-binary'});
|
||||
modelMetadata.url = URL.createObjectURL(blob); // Set the hacked URL in the model metadata XXX: revoked on App.vue
|
||||
} else {
|
||||
delete builtModelsGlb[modelMetadata.name]; // Remove from built models if it's a remove request
|
||||
|
||||
@@ -53,7 +53,7 @@ export async function uploadFile(name: string, data: Uint8Array): Promise<string
|
||||
// Upload file to the locker
|
||||
const uploadUrl = `https://vouz-backend.onrender.com/api/upload`;
|
||||
const formData = new FormData();
|
||||
formData.append('file', new Blob([data], {type: 'application/octet-stream'}), name);
|
||||
formData.append('file', new Blob([data as ArrayBufferView<ArrayBuffer>], {type: 'application/octet-stream'}), name);
|
||||
formData.append("name", encrypt(lockerName));
|
||||
formData.append("passkey", encrypt(lockerName));
|
||||
const response = await fetch(uploadUrl, {
|
||||
|
||||
Reference in New Issue
Block a user