MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / fitCameraToObject

Function fitCameraToObject

renderer.js:11737–11762  ·  view source on GitHub ↗
(camera, object, scene, renderer)

Source from the content-addressed store, hash-verified

11735 apiKeyEl.value = '';
11736 }
11737
11738 // Save the new values to the database
11739 await window.electron.saveSetting('apiEndpoint', endpointEl.value).catch(err => console.error('Error saving endpoint:', err));
11740 await window.electron.saveSetting('aiModel', modelEl.value).catch(err => console.error('Error saving model:', err));
11741 await window.electron.saveSetting('aiService', selectedService).catch(err => console.error('Error saving service:', err));
11742 console.log('[AI Config] Service changed to:', selectedService, 'and saved to database');
11743 });
11744
11745 // Add missing function renderThumbnail used in generateThumbnail().
11746 async function renderThumbnail(file) {
11747 try {
11748 // Determine filePath: if file is a string, use it directly; otherwise, assume it's an object with filePath property.
11749 const filePath = (typeof file === 'string') ? file : file.filePath;
11750 if (!filePath) {
11751 throw new Error("renderThumbnail: filePath is undefined");
11752 }
11753 // Create a temporary container (not attached to DOM — retainDetached required)
11754 const tempContainer = document.createElement('div');
11755 // Call renderModelToPNG with the filePath; no existing thumbnail provided.
11756 const thumbnail = await renderModelToPNG(filePath, tempContainer, null, {
11757 retainDetached: true
11758 });
11759 return thumbnail;
11760 } catch (error) {
11761 console.error("Error in renderThumbnail:", error);
11762 throw error;
11763 }
11764 }
11765

Callers 2

renderSTLThumbnailFunction · 0.85
renderModelToPNGFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected