Recorte de imagem com ponto focal (moldura proporcional, arrastar, teclado, saída 2x)

Offen
#1,217 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
38/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
html, tailwindcss, typescript

Rechercherichtung

Start from index.ts exports and Image.svelte to match existing API conventions, then add a pure cropPlan module under ./utils/crop and an ImageCrop component. Verify against the acceptance criteria: 3000×1500 at 16:9 exports 3840×2160 within 1e-2, drag clamps within source bounds, arrow steps of 0.02 update aria-valuetext, and canvas.toBlob honors the requested MIME type. The private AC paths are reference only, so rely on the proposed API and write component tests for the geometry helpers plus the 390 px layout.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

area:components area:forms enhancement

Versão: @codeatlasdev/ui 4.6.0 · código lido em main (950628f2) · classe: lacuna (migração do AC)

Problema

O AC depende deste comportamento hoje e a lib não o oferece. Sem ele, a migração perde qualidade no desktop, no mobile ou no PWA.

O que a lib já oferece (para não duplicar) e o que falta

(leitura de origin/main: index.ts exports e Image.svelte lido via raw) Image tem ratio e fit (cover/contain) para exibir, mas não recorta nem exporta arquivo. FileUpload tem capture e drop. Não há cropper nem ponto focal.

Referência no AC

Caminhos do repo AC (repo privado, só caminho):

apps/web/src/components/videowall-banners/crop-dialog.tsx (CropDialog, renderCrop, moldura role="slider", setas de 0,02, "Cortar e enviar" e "Manter e usar ponto focal"); banners.helpers.ts:273-296 (cropPlan com retinaScale 2, focalFromCrop); components/creative/art-uploader.tsx:40, 93-98, 149-183 ("Ajustar recorte" abre o diálogo com slot e orientation).

Defeitos do AC (verificados por leitura do código): (leitura) nenhum visível. Ponto focal sem alternativa de toque fora do arrastar: as setas cobrem teclado.

Proposta

<ImageCrop bind:focal src mime={image/jpeg|image/png} aspect={{w,h}} retina={2} onconfirm={(blob) => {}} onkeepfocal={(f) => {}} />, com cropPlan puro exportado (./forms ou ./utils/crop), saída via canvas.toBlob e :focus-visible nas setas. Sem crossorigin a saída falha: documentar.

Critério de aceite (testável)

  • Imagem 3000×1500 com aspecto 16:9 gera saída 3840×2160 (retina 2x) e o blob respeita a proporção com erro ≤ 1e-2.
  • Arrastar a moldura até a borda mantém crop.left >= 0 e crop.left + crop.width <= src.width.
  • Setas movem o foco em passos de 0,02 e o aria-valuetext mostra "Ponto focal X% x, Y% y".
  • Com mime="image/png" o blob tem type image/png; com JPEG, image/jpeg.
  • Em 390 px, o diálogo ocupa a folha inferior e a moldura cabe em max-h-[55vh] sem rolagem horizontal.

Mãe: #1089

Vorherrschende Sprache
TypeScript
Sterne
6
Forks
3
Ø Merge
5 Std. 21 Min.
Gemergte PRs (30 T.)
378

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus codeatlasdev/ui

Alle Issues in codeatlasdev/ui

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.