Clean up debugging logs and fix Quick Play image sizing
- Remove excessive debugging logs from desktop-file-manager.js and porn-cinema.html - Keep essential logging while reducing console noise - Fix Quick Play task image sizing by removing manual dimension calculations - Let CSS handle image scaling with object-fit: contain for proper aspect ratio - Clear previous inline dimensions to prevent CSS conflicts - Images should now properly fit within container boundaries
This commit is contained in:
parent
b7cfc25f33
commit
52cd3329f1
|
|
@ -285,26 +285,13 @@
|
|||
|
||||
// Force refresh of linked directories to ensure we have the latest video data
|
||||
try {
|
||||
// First check what's currently in localStorage
|
||||
const storedData = localStorage.getItem('linkedVideoDirectories');
|
||||
const parsedData = storedData ? JSON.parse(storedData) : null;
|
||||
console.log('📁 Stored directory data:', parsedData);
|
||||
if (parsedData && parsedData.directories) {
|
||||
console.log('📁 Directory list from storage:', parsedData.directories.map(d => ({ name: d.name, path: d.path })));
|
||||
}
|
||||
|
||||
// If we're reusing the main window's file manager, don't reload/refresh
|
||||
if (window.opener && window.opener.game && window.opener.game.fileManager) {
|
||||
console.log('📁 Using directories from main window file manager');
|
||||
} else {
|
||||
// Only reload and refresh if we created a new instance
|
||||
console.log('📁 Loading directories for new file manager instance');
|
||||
await window.desktopFileManager.loadLinkedDirectories();
|
||||
console.log(`✅ Force reloaded linked directories: ${window.desktopFileManager.externalVideoDirectories.length} directories`);
|
||||
}
|
||||
|
||||
// Log final state
|
||||
console.log(`📁 Final state: ${window.desktopFileManager.getAllVideos().length} videos from ${window.desktopFileManager.externalVideoDirectories.length} directories`);
|
||||
} catch (error) {
|
||||
console.warn('⚠️ Error refreshing directories:', error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -864,25 +864,16 @@
|
|||
taskImage.src = task.image;
|
||||
taskImage.style.display = 'block';
|
||||
|
||||
// Clear any previously set dimensions to let CSS handle sizing
|
||||
taskImage.style.width = '';
|
||||
taskImage.style.height = '';
|
||||
|
||||
// Ensure proper image scaling when loaded
|
||||
taskImage.onload = function() {
|
||||
console.log('Image loaded, dimensions:', this.naturalWidth, 'x', this.naturalHeight);
|
||||
|
||||
// Get container dimensions
|
||||
const container = taskImageContainer || this.parentElement;
|
||||
const containerRect = container.getBoundingClientRect();
|
||||
console.log('Container dimensions:', containerRect.width, 'x', containerRect.height);
|
||||
|
||||
// Calculate scale to fit within container
|
||||
const scaleX = (containerRect.width - 40) / this.naturalWidth; // Account for padding and border
|
||||
const scaleY = (containerRect.height - 40) / this.naturalHeight; // Account for padding and border
|
||||
const scale = Math.min(scaleX, scaleY, 1); // Don't scale up, only down
|
||||
|
||||
console.log('Calculated scale:', scale);
|
||||
|
||||
// Apply calculated dimensions
|
||||
this.style.width = Math.floor(this.naturalWidth * scale) + 'px';
|
||||
this.style.height = Math.floor(this.naturalHeight * scale) + 'px';
|
||||
// Let CSS handle the scaling with object-fit: contain
|
||||
// Just ensure max dimensions are respected
|
||||
this.style.maxWidth = '100%';
|
||||
this.style.maxHeight = '100%';
|
||||
};
|
||||
|
|
@ -1139,6 +1130,12 @@
|
|||
if (taskImage && currentTask.image) {
|
||||
taskImage.src = currentTask.image;
|
||||
taskImage.style.display = 'block';
|
||||
|
||||
// Clear any previously set dimensions to let CSS handle sizing
|
||||
taskImage.style.width = '';
|
||||
taskImage.style.height = '';
|
||||
taskImage.style.maxWidth = '100%';
|
||||
taskImage.style.maxHeight = '100%';
|
||||
}
|
||||
} else {
|
||||
// Fallback - clear loading message
|
||||
|
|
@ -1874,8 +1871,8 @@
|
|||
}
|
||||
|
||||
.task-image {
|
||||
max-width: calc(100% - 20px); /* Account for padding */
|
||||
max-height: calc(100% - 20px); /* Account for padding */
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: auto;
|
||||
height: auto;
|
||||
object-fit: contain; /* Maintain aspect ratio and fit completely */
|
||||
|
|
@ -1891,9 +1888,10 @@
|
|||
object-fit: contain;
|
||||
}
|
||||
|
||||
/* For very tall images, prioritize fitting height */
|
||||
/* Additional constraint for very large images */
|
||||
.task-image {
|
||||
max-height: min(calc(100vh - 300px), calc(100% - 20px)); /* Account for header and text */
|
||||
max-width: min(calc(100vw - 300px), 100%); /* Account for sidebar */
|
||||
max-height: min(calc(100vh - 300px), 100%); /* Account for header and text */
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
|
|
|
|||
|
|
@ -443,7 +443,6 @@ class DesktopFileManager {
|
|||
|
||||
for (const directory of this.externalVideoDirectories) {
|
||||
try {
|
||||
console.log(`🔍 Rescanning: ${directory.name} at ${directory.path}`);
|
||||
const videoFiles = await window.electronAPI.readVideoDirectoryRecursive(directory.path);
|
||||
|
||||
const linkedVideos = videoFiles.map(video => ({
|
||||
|
|
@ -467,12 +466,9 @@ class DesktopFileManager {
|
|||
// Clear any previous errors
|
||||
delete directory.lastError;
|
||||
delete directory.lastErrorTime;
|
||||
|
||||
console.log(`✅ Found ${videoFiles.length} videos in ${directory.name}`);
|
||||
|
||||
} catch (error) {
|
||||
console.error(`❌ Could not access directory ${directory.name} at ${directory.path}:`, error);
|
||||
console.error(`❌ Directory will be marked as inaccessible but kept in list`);
|
||||
console.warn(`Could not access directory ${directory.name}:`, error);
|
||||
|
||||
hasAccessErrors = true;
|
||||
|
||||
|
|
@ -488,8 +484,6 @@ class DesktopFileManager {
|
|||
// This prevents clearing valid directories due to temporary access issues
|
||||
if (!hasAccessErrors || this.externalVideoDirectories.length === 0) {
|
||||
await this.saveLinkedDirectories();
|
||||
} else {
|
||||
console.warn('⚠️ Skipping save due to directory access errors to preserve valid directories');
|
||||
}
|
||||
|
||||
await this.updateUnifiedVideoStorage();
|
||||
|
|
@ -504,7 +498,6 @@ class DesktopFileManager {
|
|||
lastUpdated: new Date().toISOString()
|
||||
};
|
||||
this.dataManager.set('linkedVideoDirectories', data);
|
||||
console.log(`💾 Saved ${this.externalVideoDirectories.length} linked directories to storage`);
|
||||
}
|
||||
|
||||
async loadLinkedDirectories() {
|
||||
|
|
@ -514,26 +507,13 @@ class DesktopFileManager {
|
|||
|
||||
try {
|
||||
const data = this.dataManager.get('linkedVideoDirectories');
|
||||
console.log('📂 Raw directory data from storage:', data);
|
||||
|
||||
if (data && data.directories) {
|
||||
this.externalVideoDirectories = data.directories;
|
||||
console.log(`📁 Loaded ${this.externalVideoDirectories.length} linked directories from storage`);
|
||||
console.log('📁 Directory details:', this.externalVideoDirectories.map(d => ({ name: d.name, path: d.path, id: d.id })));
|
||||
|
||||
// Log what we're about to refresh
|
||||
console.log(`🔄 About to refresh ${this.externalVideoDirectories.length} directories...`);
|
||||
for (const dir of this.externalVideoDirectories) {
|
||||
console.log(` 📁 ${dir.name}: ${dir.path}`);
|
||||
}
|
||||
|
||||
// Refresh all directories to get current video lists
|
||||
await this.refreshAllDirectories();
|
||||
|
||||
// Log final state after refresh
|
||||
console.log(`📁 After refresh: ${this.externalVideoDirectories.length} directories, ${this.allLinkedVideos.length} videos`);
|
||||
} else {
|
||||
console.log('📁 No stored directories found');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error loading linked directories:', error);
|
||||
|
|
|
|||
Loading…
Reference in New Issue