feat: enhance PDF comparison with new change types and zoom functionality

- Added support for 'moved' and 'style-changed' change types in PDF comparison.
- Implemented category filters for changes, allowing users to filter by text, images, headers, annotations, formatting, and background.
- Introduced zoom functionality with buttons for zooming in, out, and resetting to default.
- Updated UI to reflect new change types and categories, including visual indicators for moved and style-changed items.
- Enhanced summary display to include counts for moved and style-changed changes.
- Refactored rendering logic to accommodate zoom levels and improve performance.
- Added tests for new change detection features and category assignments.
This commit is contained in:
alam00000 committed 2026-03-10 13:51:23 +05:30
1 parent 89d7cd8e3d
commit 5232102ac0
31 files changed
+2503 -183

No files matched your search

+14 -2
View File
@@ -6,7 +6,7 @@ import type {
ComparePdfExportMode,
} from '../types.ts';
import { extractPageModel } from '../engine/extract-page-model.ts';
import { comparePageModels } from '../engine/compare-page-models.ts';
import { comparePageModelsAsync } from '../engine/compare-page-models.ts';
import {
COMPARE_COLORS,
HIGHLIGHT_OPACITY,
@@ -42,6 +42,18 @@ const HIGHLIGHT_COLORS: Record<
b: COMPARE_COLORS.modified.b / 255,
opacity: HIGHLIGHT_OPACITY,
},
moved: {
r: COMPARE_COLORS.moved.r / 255,
g: COMPARE_COLORS.moved.g / 255,
b: COMPARE_COLORS.moved.b / 255,
opacity: HIGHLIGHT_OPACITY,
},
'style-changed': {
r: COMPARE_COLORS['style-changed'].r / 255,
g: COMPARE_COLORS['style-changed'].g / 255,
b: COMPARE_COLORS['style-changed'].b / 255,
opacity: HIGHLIGHT_OPACITY,
},
};
const EXTRACT_SCALE = COMPARE_RENDER.EXPORT_EXTRACT_SCALE;
@@ -124,7 +136,7 @@ export async function exportComparePdf(
)
: null;
const comparison = comparePageModels(leftModel, rightModel);
const comparison = await comparePageModelsAsync(leftModel, rightModel);
const changes = comparison.changes;
if (mode === 'split') {