This commit is contained in:
Reece Browne 2025-08-26 09:14:41 +01:00
parent 4a1c919cb8
commit d66b6a1fbc
5 changed files with 7 additions and 11 deletions

View File

@ -698,14 +698,16 @@ const PageEditor = ({
zIndex: 10
}}
>
{Array.from(splitPositions).map((position) => {
// Match DragDropGrid's layout calculations exactly
{(() => {
// Calculate remToPx once outside the map to avoid layout thrashing
const containerWidth = containerDimensions.width;
const remToPx = parseFloat(getComputedStyle(document.documentElement).fontSize);
const ITEM_WIDTH = parseFloat(GRID_CONSTANTS.ITEM_WIDTH) * remToPx;
const ITEM_HEIGHT = parseFloat(GRID_CONSTANTS.ITEM_HEIGHT) * remToPx;
const ITEM_GAP = parseFloat(GRID_CONSTANTS.ITEM_GAP) * remToPx;
return Array.from(splitPositions).map((position) => {
// Calculate items per row using DragDropGrid's logic
const availableWidth = containerWidth - ITEM_GAP; // Account for first gap
const itemWithGap = ITEM_WIDTH + ITEM_GAP;
@ -736,7 +738,8 @@ const PageEditor = ({
}}
/>
);
})}
});
})()}
</div>
{/* Pages Grid */}

View File

@ -58,7 +58,7 @@ export class DocumentManipulationService {
const documents: PDFDocument[] = [];
const splitPoints: number[] = [];
// Find split points - pages with splitAfter create split points AFTER them
// Find split points
document.pages.forEach((page, index) => {
if (page.splitAfter) {
console.log(`Found split marker at page ${page.pageNumber} (index ${index}), adding split point at ${index + 1}`);
@ -117,8 +117,6 @@ export class DocumentManipulationService {
// Apply rotation changes from DOM
updatedPage.rotation = this.getRotationFromDOM(pageElement, page);
// Apply split marker changes from document state (already handled by commands)
// Split markers are already updated by ToggleSplitCommand, so no DOM reading needed
return updatedPage;
}

View File

@ -211,7 +211,6 @@ export class PDFExportService {
* Download multiple files as a ZIP
*/
async downloadAsZip(blobs: Blob[], filenames: string[], zipFilename: string): Promise<void> {
// For now, download files individually
blobs.forEach((blob, index) => {
setTimeout(() => {
this.downloadFile(blob, filenames[index]);

View File

@ -94,7 +94,6 @@ class PDFWorkerManager {
try {
loadingTask.destroy();
} catch (destroyError) {
// Silent cleanup failure
}
}
throw error;
@ -167,7 +166,6 @@ class PDFWorkerManager {
try {
pdf.destroy();
} catch (error) {
// Silent cleanup
}
});

View File

@ -208,8 +208,6 @@ export class ThumbnailGenerationService {
// Release reference to PDF document (don't destroy - keep in cache)
this.releasePDFDocument(fileId);
// Optionally clean up PDF document from cache to free workers faster
// This can be called after thumbnail generation is complete for a file
this.cleanupCompletedDocument(fileId);
return allResults;