A photo manager for VRChat.

fix photos being loaded with the wrong resolution

phaz.uk d4078e02 d936ae1c

verified
Changed files
+26 -18
src
src-tauri
src
frontend_calls
+2 -1
changelog
··· 112 - Fixed scroll to top button being ontop of filters menu 113 - Fixed photo ordering 114 - Fixed automatic updates 115 - - Fixed broken legacy named photos
··· 112 - Fixed scroll to top button being ontop of filters menu 113 - Fixed photo ordering 114 - Fixed automatic updates 115 + - Fixed broken legacy named photos 116 + - Fixed photos being loaded with the wrong resolution
-2
src-tauri/src/frontend_calls/load_photos.rs
··· 11 size: usize, 12 } 13 14 - // TODO: Multi-layer photos 15 - 16 #[tauri::command] 17 pub fn load_photos(window: tauri::Window, cache: State<Cache> ) { 18 let base_dir = cache.get("photo-path".into()).unwrap();
··· 11 size: usize, 12 } 13 14 #[tauri::command] 15 pub fn load_photos(window: tauri::Window, cache: State<Cache> ) { 16 let base_dir = cache.get("photo-path".into()).unwrap();
+2 -2
src/Components/Managers/PhotoListRenderingManager.tsx
··· 124 let photo = (el as PhotoListPhoto).Photo; 125 126 // === DEBUG === 127 - // ctx.strokeStyle = '#f00'; 128 - // ctx.strokeRect((rowXPos - row.Width / 2) + canvas.width / 2, currentY - scroll, photo.scaledWidth!, row.Height); 129 130 if(!photo.loaded) 131 // If the photo is not loaded, start a new task and load it in that task
··· 124 let photo = (el as PhotoListPhoto).Photo; 125 126 // === DEBUG === 127 + ctx.strokeStyle = '#f00'; 128 + ctx.strokeRect((rowXPos - row.Width / 2) + canvas.width / 2, currentY - scroll, photo.scaledWidth!, row.Height); 129 130 if(!photo.loaded) 131 // If the photo is not loaded, start a new task and load it in that task
+4 -1
src/Components/Managers/PhotoManager.tsx
··· 89 }); 90 91 this.Photos = MergeSort(this.Photos); 92 - console.log(this.Photos); 93 94 console.log(this.Photos.length + ' Photos found.'); 95 if(this.Photos.length === 0 || photoPaths.length > Vars.MAX_PHOTOS_BULK_LOAD){ 96 console.log('No photos found or over bulk load limit, Skipping loading stage.'); 97 ··· 128 129 photo.metaLoaded = true; 130 photo.onMetaLoaded(); 131 132 if(this._amountLoaded === this.Photos.length - 1 && !this.HasFirstLoaded){ 133 this.FilteredPhotos = this.Photos;
··· 89 }); 90 91 this.Photos = MergeSort(this.Photos); 92 + console.log(this.Photos[0]); 93 94 console.log(this.Photos.length + ' Photos found.'); 95 + 96 if(this.Photos.length === 0 || photoPaths.length > Vars.MAX_PHOTOS_BULK_LOAD){ 97 console.log('No photos found or over bulk load limit, Skipping loading stage.'); 98 ··· 129 130 photo.metaLoaded = true; 131 photo.onMetaLoaded(); 132 + 133 + window.PhotoListRenderingManager.ComputeLayout(); 134 135 if(this._amountLoaded === this.Photos.length - 1 && !this.HasFirstLoaded){ 136 this.FilteredPhotos = this.Photos;
-1
src/Components/PhotoList.tsx
··· 154 }) 155 156 window.PhotoListRenderingManager.SetCanvas(photoContainer!); 157 - window.PhotoListRenderingManager.ComputeLayout(); 158 159 render(); 160 });
··· 154 }) 155 156 window.PhotoListRenderingManager.SetCanvas(photoContainer!); 157 158 render(); 159 });
+7
src/Components/PhotoViewer.tsx
··· 367 ) 368 } 369 370 return ( 371 <div class="photo-viewer" ref={( el ) => viewer = el}> 372 <div class="photo-context-menu" ref={( el ) => viewerContextMenu = el}> ··· 442 443 <Show when={window.PhotoViewerManager.CurrentPhoto()?.isMultiLayer}> 444 <div class="viewer-button" 445 onMouseOver={( el ) => animate(el.currentTarget, { width: '40px', height: '40px', 'margin-left': '15px', 'margin-right': '15px', 'margin-top': '-10px' })} 446 onMouseLeave={( el ) => animate(el.currentTarget, { width: '30px', height: '30px', 'margin-left': '20px', 'margin-right': '20px', 'margin-top': '0px' })} 447 >
··· 367 ) 368 } 369 370 + let toggleLayerManager = () => { 371 + 372 + } 373 + 374 + // TODO: Make layers selectable 375 + 376 return ( 377 <div class="photo-viewer" ref={( el ) => viewer = el}> 378 <div class="photo-context-menu" ref={( el ) => viewerContextMenu = el}> ··· 448 449 <Show when={window.PhotoViewerManager.CurrentPhoto()?.isMultiLayer}> 450 <div class="viewer-button" 451 + onClick={toggleLayerManager} 452 onMouseOver={( el ) => animate(el.currentTarget, { width: '40px', height: '40px', 'margin-left': '15px', 'margin-right': '15px', 'margin-top': '-10px' })} 453 onMouseLeave={( el ) => animate(el.currentTarget, { width: '30px', height: '30px', 'margin-left': '20px', 'margin-right': '20px', 'margin-top': '0px' })} 454 >
+11 -11
src/Components/Structs/Photo.ts
··· 75 else 76 resSplit = split[3].split('x') 77 78 - let width = parseInt(resSplit[0]); 79 - let height = parseInt(resSplit[1]); 80 81 - if(!isNaN(width) || !isNaN(height)){ 82 - this.width = width; 83 - this.height = height; 84 - 85 - let scale = Vars.PHOTO_HEIGHT / this.height; 86 - 87 - this.scaledWidth = this.width * scale; 88 - this.scaledHeight = Vars.PHOTO_HEIGHT; 89 - } 90 } 91 92 loadMeta(){
··· 75 else 76 resSplit = split[3].split('x') 77 78 + // let width = parseInt(resSplit[0]); 79 + // let height = parseInt(resSplit[1]); 80 81 + // if(!isNaN(width) || !isNaN(height)){ 82 + // this.width = width; 83 + // this.height = height; 84 + 85 + // let scale = Vars.PHOTO_HEIGHT / this.height; 86 + 87 + // this.scaledWidth = this.width * scale; 88 + // this.scaledHeight = Vars.PHOTO_HEIGHT; 89 + // } 90 } 91 92 loadMeta(){