Make the focused-view crop live in the editor canvas
Template tests / tests (push) Successful in 1m39s
Template tests / tests (pull_request) Successful in 1m40s

The annotation canvas now renders as a viewport into the focused-view
crop region, matching what core/raster.js produces on export. Sliders
update the canvas live; annotation data stays in full-image-normalized
coordinates and remains correctly positioned, sized, and editable.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
2026-06-13 18:09:17 -05:00
co-authored by Claude Sonnet 4.6
parent 91495a3614
commit f23b49c0d1
2 changed files with 71 additions and 17 deletions
+3
View File
@@ -397,6 +397,7 @@ class GuideEditor {
step.focusedView[field] = Number(node.value);
this.pendingSave = true;
this.saveStepDebounced();
this.canvas.setFocusedView(step.focusedView);
});
bindFocusedSlider(this.dom.fvZoom, 'zoom');
bindFocusedSlider(this.dom.fvPanX, 'panX');
@@ -451,6 +452,7 @@ class GuideEditor {
this.dom.fvPanX.value = fv.panX ?? 0.5;
this.dom.fvPanY.value = fv.panY ?? 0.5;
}
this.canvas.setFocusedView(fv);
}
// ---- text / code / table blocks ----------------------------------------
@@ -852,6 +854,7 @@ class GuideEditor {
if (token !== this.imageLoadToken) return;
this.canvas.setImage(img, img.naturalWidth || img.width, img.naturalHeight || img.height);
this.canvas.setAnnotations(step.annotations || []);
this.canvas.setFocusedView(step.focusedView);
this.canvas.setTool(this.currentTool);
this.canvas.setZoom(this.currentZoom);
};