fix(ui): scaled bbox preview

This commit is contained in:
psychedelicious 2024-08-08 19:43:50 +10:00
parent b88d14b3df
commit 71885db5fd
2 changed files with 10 additions and 6 deletions

View File

@ -72,8 +72,8 @@ export class CanvasProgressImage {
this.isLoading = true;
const { x, y } = this.manager.stateApi.getBbox().rect;
const { dataURL, width, height } = this.lastProgressEvent.progress_image;
const { x, y, width, height } = this.manager.stateApi.getBbox().rect;
const { dataURL } = this.lastProgressEvent.progress_image;
try {
this.imageElement = await loadImage(dataURL);
if (this.konva.image) {

View File

@ -43,17 +43,21 @@ export class CanvasStagingArea {
render = async () => {
const session = this.manager.stateApi.getSession();
const { rect } = this.manager.stateApi.getBbox();
const { x, y, width, height } = this.manager.stateApi.getBbox().rect;
const shouldShowStagedImage = this.manager.stateApi.$shouldShowStagedImage.get();
this.selectedImage = session.stagedImages[session.selectedStagedImageIndex] ?? null;
this.konva.group.position({ x: rect.x, y: rect.y });
this.konva.group.position({ x, y });
if (this.selectedImage) {
const { imageDTO, offsetX, offsetY } = this.selectedImage;
const {
imageDTO,
// offsetX, // TODO(psyche): restore the crop in the node?
// offsetY // TODO(psyche): restore the crop in the node?
} = this.selectedImage;
if (!this.image) {
const { image_name, width, height } = imageDTO;
const { image_name } = imageDTO;
this.image = new CanvasImageRenderer(
{
id: 'staging-area-image',