feat: predvolena velkost fotky produktu 95 %
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
afb8ae98c9
commit
31b9d605cf
2 files changed
+6
-4
No files matched your search
@@ -7,7 +7,7 @@ import { BADGE_IMPORT_TYPES, BadgeTemplate, CardProduct, ProductLabel, ProductPh
|
|||||||
import { ChevronDown, ChevronUp, Trash2, Pencil, Globe, Layers } from 'lucide-react';
|
import { ChevronDown, ChevronUp, Trash2, Pencil, Globe, Layers } from 'lucide-react';
|
||||||
import { ImageUploadInput } from './ImageUploadInput';
|
import { ImageUploadInput } from './ImageUploadInput';
|
||||||
import { pickAlt } from '@/lib/altText';
|
import { pickAlt } from '@/lib/altText';
|
||||||
import { DEFAULT_STORES_OFFSET_X, DEFAULT_STORES_OFFSET_Y, DEFAULT_STORES_SIZE, MAIN_PHOTO, PRODUCT_BG_PRESETS, badgeWidthFor, photoStack, productCardAlt, usesAppPrice } from '@/lib/productCard';
|
import { DEFAULT_IMAGE_SCALE, DEFAULT_STORES_OFFSET_X, DEFAULT_STORES_OFFSET_Y, DEFAULT_STORES_SIZE, MAIN_PHOTO, PRODUCT_BG_PRESETS, badgeWidthFor, photoStack, productCardAlt, usesAppPrice } from '@/lib/productCard';
|
||||||
|
|
||||||
export { PRODUCT_BG_PRESETS };
|
export { PRODUCT_BG_PRESETS };
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ export const ProductEditor: React.FC<ProductEditorProps> = ({
|
|||||||
const isLoyalty = variant === 'loyalty';
|
const isLoyalty = variant === 'loyalty';
|
||||||
const set = (key: string) => (v: unknown) => onChange({ [key]: v });
|
const set = (key: string) => (v: unknown) => onChange({ [key]: v });
|
||||||
|
|
||||||
const scale = p.imageScale ?? 1;
|
const scale = p.imageScale ?? DEFAULT_IMAGE_SCALE;
|
||||||
const offsetX = p.imageOffsetX || 0;
|
const offsetX = p.imageOffsetX || 0;
|
||||||
const offsetY = p.imageOffsetY || 0;
|
const offsetY = p.imageOffsetY || 0;
|
||||||
const storesX = p.storesOffsetX ?? DEFAULT_STORES_OFFSET_X;
|
const storesX = p.storesOffsetX ?? DEFAULT_STORES_OFFSET_X;
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ export interface StoresOffset {
|
|||||||
x?: number; // + doprava, − doľava
|
x?: number; // + doprava, − doľava
|
||||||
y?: number; // + vyššie nad cenovku, − nižšie (cez horný okraj cenovky)
|
y?: number; // + vyššie nad cenovku, − nižšie (cez horný okraj cenovky)
|
||||||
}
|
}
|
||||||
|
// Predvolená veľkosť fotky produktu (zoom), keď ju produkt nemá nastavenú
|
||||||
|
export const DEFAULT_IMAGE_SCALE = 0.95;
|
||||||
// Predvolená poloha štítkov voči pravému hornému rohu pozadia cenovky
|
// Predvolená poloha štítkov voči pravému hornému rohu pozadia cenovky
|
||||||
export const DEFAULT_STORES_OFFSET_X = -23;
|
export const DEFAULT_STORES_OFFSET_X = -23;
|
||||||
// Predvolená výška jedného štítka predajne (px), nezávislá od veľkosti cenovky
|
// Predvolená výška jedného štítka predajne (px), nezávislá od veľkosti cenovky
|
||||||
@@ -214,7 +216,7 @@ export function cardVisualKey(p: CardProduct, ctx: CardContext): string {
|
|||||||
const t = p.badgeCustomTemplate;
|
const t = p.badgeCustomTemplate;
|
||||||
const relevant = [
|
const relevant = [
|
||||||
ctx.variant, ctx.cardWidth, p.cardBgColor || ctx.cardBg, ctx.variant === 'standard' ? ctx.defaultBadge : null,
|
ctx.variant, ctx.cardWidth, p.cardBgColor || ctx.cardBg, ctx.variant === 'standard' ? ctx.defaultBadge : null,
|
||||||
p.imageUrl, p.imageScale ?? 1, p.imageOffsetX || 0, p.imageOffsetY || 0,
|
p.imageUrl, p.imageScale ?? DEFAULT_IMAGE_SCALE, p.imageOffsetX || 0, p.imageOffsetY || 0,
|
||||||
p.customBadgePngUrl, badgeWidthFor(p, ctx.variant),
|
p.customBadgePngUrl, badgeWidthFor(p, ctx.variant),
|
||||||
t ? [t.svgRaw, t.layersConfig, t.width] : null,
|
t ? [t.svgRaw, t.layersConfig, t.width] : null,
|
||||||
p.priceMain, p.priceSub, p.discountText, p.badgeText, p.unitPrice,
|
p.priceMain, p.priceSub, p.discountText, p.badgeText, p.unitPrice,
|
||||||
@@ -323,7 +325,7 @@ function renderVisualPreview(p: CardProduct, ctx: CardContext, key: string): str
|
|||||||
const height = cardVisualHeight(ctx.cardWidth);
|
const height = cardVisualHeight(ctx.cardWidth);
|
||||||
const bg = p.cardBgColor || ctx.cardBg;
|
const bg = p.cardBgColor || ctx.cardBg;
|
||||||
const bw = badgeWidthFor(p, ctx.variant);
|
const bw = badgeWidthFor(p, ctx.variant);
|
||||||
const scale = p.imageScale ?? 1;
|
const scale = p.imageScale ?? DEFAULT_IMAGE_SCALE;
|
||||||
const ox = p.imageOffsetX || 0;
|
const ox = p.imageOffsetX || 0;
|
||||||
const oy = p.imageOffsetY || 0;
|
const oy = p.imageOffsetY || 0;
|
||||||
const sx = Math.round(p.storesOffsetX ?? DEFAULT_STORES_OFFSET_X);
|
const sx = Math.round(p.storesOffsetX ?? DEFAULT_STORES_OFFSET_X);
|
||||||
|
|||||||
Reference in new issue
Block a user