mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-27 06:39:24 +00:00
Clean up
This commit is contained in:
parent
4a1c919cb8
commit
d66b6a1fbc
@ -698,14 +698,16 @@ const PageEditor = ({
|
|||||||
zIndex: 10
|
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 containerWidth = containerDimensions.width;
|
||||||
const remToPx = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
const remToPx = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||||
const ITEM_WIDTH = parseFloat(GRID_CONSTANTS.ITEM_WIDTH) * remToPx;
|
const ITEM_WIDTH = parseFloat(GRID_CONSTANTS.ITEM_WIDTH) * remToPx;
|
||||||
const ITEM_HEIGHT = parseFloat(GRID_CONSTANTS.ITEM_HEIGHT) * remToPx;
|
const ITEM_HEIGHT = parseFloat(GRID_CONSTANTS.ITEM_HEIGHT) * remToPx;
|
||||||
const ITEM_GAP = parseFloat(GRID_CONSTANTS.ITEM_GAP) * remToPx;
|
const ITEM_GAP = parseFloat(GRID_CONSTANTS.ITEM_GAP) * remToPx;
|
||||||
|
|
||||||
|
return Array.from(splitPositions).map((position) => {
|
||||||
|
|
||||||
// Calculate items per row using DragDropGrid's logic
|
// Calculate items per row using DragDropGrid's logic
|
||||||
const availableWidth = containerWidth - ITEM_GAP; // Account for first gap
|
const availableWidth = containerWidth - ITEM_GAP; // Account for first gap
|
||||||
const itemWithGap = ITEM_WIDTH + ITEM_GAP;
|
const itemWithGap = ITEM_WIDTH + ITEM_GAP;
|
||||||
@ -736,7 +738,8 @@ const PageEditor = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
});
|
||||||
|
})()}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Pages Grid */}
|
{/* Pages Grid */}
|
||||||
|
@ -58,7 +58,7 @@ export class DocumentManipulationService {
|
|||||||
const documents: PDFDocument[] = [];
|
const documents: PDFDocument[] = [];
|
||||||
const splitPoints: number[] = [];
|
const splitPoints: number[] = [];
|
||||||
|
|
||||||
// Find split points - pages with splitAfter create split points AFTER them
|
// Find split points
|
||||||
document.pages.forEach((page, index) => {
|
document.pages.forEach((page, index) => {
|
||||||
if (page.splitAfter) {
|
if (page.splitAfter) {
|
||||||
console.log(`Found split marker at page ${page.pageNumber} (index ${index}), adding split point at ${index + 1}`);
|
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
|
// Apply rotation changes from DOM
|
||||||
updatedPage.rotation = this.getRotationFromDOM(pageElement, page);
|
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;
|
return updatedPage;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,6 @@ export class PDFExportService {
|
|||||||
* Download multiple files as a ZIP
|
* Download multiple files as a ZIP
|
||||||
*/
|
*/
|
||||||
async downloadAsZip(blobs: Blob[], filenames: string[], zipFilename: string): Promise<void> {
|
async downloadAsZip(blobs: Blob[], filenames: string[], zipFilename: string): Promise<void> {
|
||||||
// For now, download files individually
|
|
||||||
blobs.forEach((blob, index) => {
|
blobs.forEach((blob, index) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.downloadFile(blob, filenames[index]);
|
this.downloadFile(blob, filenames[index]);
|
||||||
|
@ -94,7 +94,6 @@ class PDFWorkerManager {
|
|||||||
try {
|
try {
|
||||||
loadingTask.destroy();
|
loadingTask.destroy();
|
||||||
} catch (destroyError) {
|
} catch (destroyError) {
|
||||||
// Silent cleanup failure
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
@ -167,7 +166,6 @@ class PDFWorkerManager {
|
|||||||
try {
|
try {
|
||||||
pdf.destroy();
|
pdf.destroy();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Silent cleanup
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -208,8 +208,6 @@ export class ThumbnailGenerationService {
|
|||||||
// Release reference to PDF document (don't destroy - keep in cache)
|
// Release reference to PDF document (don't destroy - keep in cache)
|
||||||
this.releasePDFDocument(fileId);
|
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);
|
this.cleanupCompletedDocument(fileId);
|
||||||
|
|
||||||
return allResults;
|
return allResults;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user