From 081ca83613bc3958f9946264aa34dbc98ca05664 Mon Sep 17 00:00:00 2001 From: Matt Edholm Date: Thu, 14 May 2026 12:02:39 -0400 Subject: [PATCH] fix(v2): preview rotation + crop aspect for 13.3" hardware MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two related bugs that surfaced on the first 13.3" device's first photo: 1) Web-UI portrait preview was 90° sideways. DeviceApiController:: renderBinToPng rotated whenever the device was Portrait — correct for V1 (landscape-native, Portrait => renderer rotated, so preview un-rotates) but wrong for V2 (portrait-native — the renderer doesn't rotate, so the preview shouldn't either). Now mirrors the render-pipeline check: rotate only when `orientation !== model->nativeOrientation()`. Two new functional tests pin the V2 portrait and V2 landscape PNG dimensions to guard against regressions. 2) Cropped photo letterboxed on the 13.3" panel. CropEditor / StickerCanvas / FrameCard had V1 dimensions hardcoded (1600×960 = 5:3 aspect). V2 is 4:3 (1200×1600 portrait / 1600×1200 landscape), so a "full crop" came out the wrong shape and the server's white-canvas composite added bars. New `panelDims(model, orientation)` helper in @/types is the single source of truth on the frontend; matches DeviceModel::width/height on the server. Threaded `model` through Device serializer → Device type → UploadView → CropEditor / StickerCanvas, and HomeView → FrameCard. FrameCard tests updated to cover all four model × orientation placeholders. Co-Authored-By: Claude Opus 4.7 (1M context) --- frontend/src/components/CropEditor.vue | 15 +-- frontend/src/components/FrameCard.vue | 14 ++- frontend/src/components/StickerCanvas.vue | 11 ++- .../src/test/components/FrameCard.test.ts | 28 ++++-- frontend/src/types/index.ts | 27 ++++++ frontend/src/views/HomeView.vue | 2 + frontend/src/views/UploadView.vue | 7 +- src/Controller/DeviceApiController.php | 16 +++- src/Service/DeviceSerializer.php | 1 + .../Controller/DeviceApiControllerTest.php | 95 +++++++++++++++++++ tests/Unit/Service/DeviceSerializerTest.php | 10 +- 11 files changed, 198 insertions(+), 28 deletions(-) diff --git a/frontend/src/components/CropEditor.vue b/frontend/src/components/CropEditor.vue index ff90802..0529886 100644 --- a/frontend/src/components/CropEditor.vue +++ b/frontend/src/components/CropEditor.vue @@ -57,7 +57,7 @@