feat: velkost stitkov predajni nezavisla od velkosti cenovky

- novy posuvnik Velkost stitkov pri produkte (predvolene 14 px)
- Polohu a velkost stitkov pouzit na vsetky produkty prenesie aj velkost

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub_HostacnyandClaude Opus 5.5 committed 2026-10-21 12:36:48 +02:00
1 parent 8e4ad03af9
commit 6d73660cac
5 files changed
+17 -12

No files matched your search

+4 -2
View File
@@ -31,6 +31,8 @@ export interface StoresOffset {
}
// Predvolená poloha štítkov voči pravému hornému rohu pozadia cenovky
export const DEFAULT_STORES_OFFSET_X = -15;
// Predvolená výška jedného štítka predajne (px), nezávislá od veľkosti cenovky
export const DEFAULT_STORES_SIZE = 14;
export const DEFAULT_STORES_OFFSET_Y = 5;
// Výška vizuálu: pomer ako v šablóne (294 × 245), pri 1 produkte na riadok max 300 px
@@ -205,7 +207,7 @@ export function cardVisualKey(p: CardProduct, ctx: CardContext): string {
p.priceMain, p.priceSub, p.discountText, p.badgeText, p.unitPrice,
p.cardPriceMain, p.cardPriceSub, p.cardDiscount, p.cardUnitPrice,
p.noCardPriceMain, p.noCardPriceSub, p.noCardDiscount, p.noCardUnitPrice,
p.stores, p.storesOffsetX ?? DEFAULT_STORES_OFFSET_X, p.storesOffsetY ?? DEFAULT_STORES_OFFSET_Y
p.stores, p.storesOffsetX ?? DEFAULT_STORES_OFFSET_X, p.storesOffsetY ?? DEFAULT_STORES_OFFSET_Y, p.storesSize ?? DEFAULT_STORES_SIZE
];
const str = JSON.stringify(relevant);
let h1 = 5381;
@@ -267,7 +269,7 @@ function renderVisualPreview(p: CardProduct, ctx: CardContext, key: string): str
const oy = p.imageOffsetY || 0;
const sx = Math.round(p.storesOffsetX ?? DEFAULT_STORES_OFFSET_X);
const sy = Math.round(p.storesOffsetY ?? DEFAULT_STORES_OFFSET_Y);
const stores = renderStores(p, ctx.mode, Math.max(10, Math.round(bw * 0.12)));
const stores = renderStores(p, ctx.mode, p.storesSize ?? DEFAULT_STORES_SIZE);
// Pravý horný roh viditeľného pozadia cenovky (pri PNG a predvolenej cenovke = roh cenovky)
const bgBox = p.badgeCustomTemplate && !p.customBadgePngUrl ? badgeBackgroundBox(p.badgeCustomTemplate) : null;
const insetTop = bgBox ? Math.round(bgBox.top * bw * bgBox.aspect) : 0;