Enable foldable background presets
This commit is contained in:
@@ -558,6 +558,29 @@ function buildFabricOptions({
|
||||
const panelWidth = isFoldable ? baseWidth / 2 : baseWidth;
|
||||
const panelHeight = baseHeight;
|
||||
const slots = resolveSlots(layout, isFoldable, slotOverrides);
|
||||
const backgroundPanels =
|
||||
isFoldable && backgroundImageUrl
|
||||
? [
|
||||
{
|
||||
url: backgroundImageUrl,
|
||||
centerX: (panelWidth / 2) * scaleX,
|
||||
centerY: (panelHeight / 2) * scaleY,
|
||||
width: panelWidth * scaleX,
|
||||
height: panelHeight * scaleY,
|
||||
rotation: 90,
|
||||
mirrored: false,
|
||||
},
|
||||
{
|
||||
url: backgroundImageUrl,
|
||||
centerX: (panelWidth + panelWidth / 2) * scaleX,
|
||||
centerY: (panelHeight / 2) * scaleY,
|
||||
width: panelWidth * scaleX,
|
||||
height: panelHeight * scaleY,
|
||||
rotation: -90,
|
||||
mirrored: true,
|
||||
},
|
||||
]
|
||||
: null;
|
||||
|
||||
const elements: LayoutElement[] = [];
|
||||
const textColor = layout?.preview?.text ?? ADMIN_COLORS.backdrop;
|
||||
@@ -681,7 +704,8 @@ function buildFabricOptions({
|
||||
logoDataUrl: null,
|
||||
backgroundColor: backgroundSolid ?? layout?.preview?.background ?? ADMIN_COLORS.surface,
|
||||
backgroundGradient,
|
||||
backgroundImageUrl,
|
||||
backgroundImageUrl: backgroundPanels ? null : backgroundImageUrl,
|
||||
backgroundImagePanels: backgroundPanels ?? undefined,
|
||||
readOnly: true,
|
||||
} as const;
|
||||
}
|
||||
@@ -740,7 +764,7 @@ function BackgroundStep({
|
||||
paper: formatPaper,
|
||||
orientation: orientationLabel,
|
||||
});
|
||||
const disablePresets = isFoldable;
|
||||
const disablePresets = false;
|
||||
const gradientPresets = [
|
||||
{
|
||||
angle: 180,
|
||||
@@ -795,28 +819,29 @@ function BackgroundStep({
|
||||
{presets.map((preset) => {
|
||||
const isSelected = selectedPreset === preset.id;
|
||||
return (
|
||||
<Pressable key={preset.id ?? preset.labelKey} onPress={() => onSelectPreset(preset.id)} style={{ width: '48%' }}>
|
||||
<Pressable key={preset.id ?? preset.labelKey} onPress={() => onSelectPreset(preset.id)} style={{ width: '32%' }}>
|
||||
<YStack
|
||||
aspectRatio={CANVAS_WIDTH / CANVAS_HEIGHT}
|
||||
maxHeight={220}
|
||||
style={{ position: 'relative', width: '100%', paddingTop: `${(297 / 210) * 100}%`, maxHeight: 160 }}
|
||||
borderRadius={14}
|
||||
overflow="hidden"
|
||||
borderWidth={isSelected ? 2 : 1}
|
||||
borderColor={isSelected ? primary : border}
|
||||
backgroundColor={surfaceMuted}
|
||||
>
|
||||
<YStack
|
||||
flex={1}
|
||||
backgroundImage={`url(${preset.src})`}
|
||||
backgroundSize="cover"
|
||||
backgroundPosition="center"
|
||||
/>
|
||||
<XStack padding="$2" justifyContent="space-between" alignItems="center" backgroundColor="rgba(255,255,255,0.92)">
|
||||
<Text fontSize="$xs" color={textStrong}>
|
||||
{t(preset.labelKey, preset.label)}
|
||||
</Text>
|
||||
{isSelected ? <PillBadge tone="muted">{t('common.selected', 'Ausgewählt')}</PillBadge> : null}
|
||||
</XStack>
|
||||
<YStack style={{ position: 'absolute', inset: 0 }}>
|
||||
<YStack
|
||||
flex={1}
|
||||
backgroundImage={`url(${preset.src})`}
|
||||
backgroundSize="cover"
|
||||
backgroundPosition="center"
|
||||
/>
|
||||
<XStack padding="$2" justifyContent="space-between" alignItems="center" backgroundColor="rgba(255,255,255,0.92)">
|
||||
<Text fontSize="$xs" color={textStrong}>
|
||||
{t(preset.labelKey, preset.label)}
|
||||
</Text>
|
||||
{isSelected ? <PillBadge tone="muted">{t('common.selected', 'Ausgewählt')}</PillBadge> : null}
|
||||
</XStack>
|
||||
</YStack>
|
||||
</YStack>
|
||||
</Pressable>
|
||||
);
|
||||
@@ -826,11 +851,7 @@ function BackgroundStep({
|
||||
{t('events.qr.backgroundNote', 'Diese Presets sind für A4 Hochformat. Spiegelung erfolgt automatisch bei Tischkarten.')}
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
<Text fontSize="$xs" color={muted}>
|
||||
{t('events.qr.foldableBackgroundNote', 'Für A5 Tischkarten bitte Gradient oder Vollfarbe wählen.')}
|
||||
</Text>
|
||||
)}
|
||||
) : null}
|
||||
|
||||
<YStack space="$2" marginTop="$2">
|
||||
<Text fontSize="$sm" fontWeight="700" color={textStrong}>
|
||||
|
||||
Reference in New Issue
Block a user