|
209 | 209 | /> |
210 | 210 | {/if} |
211 | 211 |
|
212 | | - <!-- Text overlay above --> |
213 | | - {#if store.textOverlay.enabled && store.textOverlay.text && store.textOverlay.position === 'above'} |
| 212 | + <!-- Text blocks (above position) --> |
| 213 | + {#each store.textBlocks.filter(t => t.text && t.position === 'above') as tb (tb.id)} |
| 214 | + {@const isSelText = store.selectedTextId === tb.id} |
| 215 | + <div |
| 216 | + class="absolute left-0 right-0 text-center" |
| 217 | + style="top: {store.padding * 0.4}px; |
| 218 | + font-size: {tb.fontSize}px; |
| 219 | + font-weight: {tb.fontWeight}; |
| 220 | + font-family: '{tb.fontFamily}', sans-serif; |
| 221 | + color: {tb.color}; |
| 222 | + text-align: {tb.textAlign}; |
| 223 | + letter-spacing: {tb.letterSpacing}px; |
| 224 | + line-height: {tb.lineHeight}; |
| 225 | + padding: 0 {store.padding}px; |
| 226 | + overflow: visible; |
| 227 | + {tb.maxWidth > 0 ? `max-width: ${tb.maxWidth}%; margin: 0 auto; word-wrap: break-word; overflow-wrap: break-word; white-space: normal;` : ''} |
| 228 | + transform: perspective(1200px) rotateX({tb.tiltX}deg) rotateY({tb.tiltY}deg) rotate({tb.rotation}deg); |
| 229 | + {tb.shadow.enabled ? `text-shadow: ${tb.shadow.offsetX}px ${tb.shadow.offsetY}px ${tb.shadow.blur}px ${tb.shadow.color};` : ''} |
| 230 | + {isSelText ? 'outline: 2px dashed rgba(236,72,153,0.4); outline-offset: 4px;' : ''}" |
| 231 | + onclick={() => store.selectTextBlock(tb.id)} |
| 232 | + > |
| 233 | + {#if tb.arcDegrees !== 0} |
| 234 | + {@const estW = Math.max(500, tb.fontSize * tb.text.length * 0.7)} |
| 235 | + {@const estH = Math.max(300, tb.fontSize * 4)} |
| 236 | + {@const pathD = makeTextPath(tb.pathType, tb.arcDegrees, estW * 0.85)} |
| 237 | + <svg viewBox="-{estW / 2} -{estH / 2} {estW} {estH}" style="width: 100%; height: {estH}px; overflow: visible; display: block;"> |
| 238 | + <defs> |
| 239 | + <path id="text-arc-{tb.id}" d={pathD} /> |
| 240 | + </defs> |
| 241 | + <text fill={tb.color} font-size={tb.fontSize} font-weight={tb.fontWeight} font-family="'{tb.fontFamily}', sans-serif" letter-spacing={tb.letterSpacing} text-anchor="middle" |
| 242 | + style={tb.shadow.enabled ? `filter: drop-shadow(${tb.shadow.offsetX}px ${tb.shadow.offsetY}px ${tb.shadow.blur}px ${tb.shadow.color})` : ''}> |
| 243 | + <textPath href="#text-arc-{tb.id}" startOffset="50%">{tb.text}</textPath> |
| 244 | + </text> |
| 245 | + </svg> |
| 246 | + {:else} |
| 247 | + {tb.text} |
| 248 | + {/if} |
| 249 | + </div> |
| 250 | + {/each} |
| 251 | + |
| 252 | + <!-- Legacy single text overlay above (backward compat) --> |
| 253 | + {#if store.textOverlay.enabled && store.textOverlay.text && store.textOverlay.position === 'above' && store.textBlocks.length === 0} |
214 | 254 | {@const to = store.textOverlay} |
215 | 255 | <div |
216 | 256 | class="absolute left-0 right-0 text-center" |
|
284 | 324 | {/if} |
285 | 325 | {/each} |
286 | 326 |
|
287 | | - <!-- Text overlay below --> |
288 | | - {#if store.textOverlay.enabled && store.textOverlay.text && store.textOverlay.position === 'below'} |
| 327 | + <!-- Text blocks (below position) --> |
| 328 | + {#each store.textBlocks.filter(t => t.text && t.position === 'below') as tb (tb.id)} |
| 329 | + {@const isSelText = store.selectedTextId === tb.id} |
| 330 | + <div |
| 331 | + class="absolute bottom-0 left-0 right-0 text-center" |
| 332 | + style="bottom: {store.padding * 0.4}px; |
| 333 | + font-size: {tb.fontSize}px; |
| 334 | + font-weight: {tb.fontWeight}; |
| 335 | + font-family: '{tb.fontFamily}', sans-serif; |
| 336 | + color: {tb.color}; |
| 337 | + text-align: {tb.textAlign}; |
| 338 | + letter-spacing: {tb.letterSpacing}px; |
| 339 | + line-height: {tb.lineHeight}; |
| 340 | + padding: 0 {store.padding}px; |
| 341 | + {tb.maxWidth > 0 ? `max-width: ${tb.maxWidth}%; margin: 0 auto; word-wrap: break-word; overflow-wrap: break-word; white-space: normal;` : ''} |
| 342 | + transform: perspective(1200px) rotateX({tb.tiltX}deg) rotateY({tb.tiltY}deg) rotate({tb.rotation}deg); |
| 343 | + {tb.shadow.enabled ? `text-shadow: ${tb.shadow.offsetX}px ${tb.shadow.offsetY}px ${tb.shadow.blur}px ${tb.shadow.color};` : ''} |
| 344 | + {isSelText ? 'outline: 2px dashed rgba(236,72,153,0.4); outline-offset: 4px;' : ''}" |
| 345 | + onclick={() => store.selectTextBlock(tb.id)} |
| 346 | + > |
| 347 | + {tb.text} |
| 348 | + </div> |
| 349 | + {/each} |
| 350 | + |
| 351 | + <!-- Text blocks (custom position) --> |
| 352 | + {#each store.textBlocks.filter(t => t.text && t.position === 'custom') as tb (tb.id)} |
| 353 | + {@const isSelText = store.selectedTextId === tb.id} |
| 354 | + <div |
| 355 | + class="absolute" |
| 356 | + style="left: {tb.x}%; top: {tb.y}%; |
| 357 | + transform: translate(-50%, -50%) perspective(1200px) rotateX({tb.tiltX}deg) rotateY({tb.tiltY}deg) rotate({tb.rotation}deg); |
| 358 | + font-size: {tb.fontSize}px; |
| 359 | + font-weight: {tb.fontWeight}; |
| 360 | + font-family: '{tb.fontFamily}', sans-serif; |
| 361 | + color: {tb.color}; |
| 362 | + text-align: {tb.textAlign}; |
| 363 | + letter-spacing: {tb.letterSpacing}px; |
| 364 | + line-height: {tb.lineHeight}; |
| 365 | + {tb.maxWidth > 0 ? `max-width: ${tb.maxWidth}%; word-wrap: break-word; overflow-wrap: break-word; white-space: normal;` : 'white-space: nowrap;'} |
| 366 | + {tb.shadow.enabled ? `text-shadow: ${tb.shadow.offsetX}px ${tb.shadow.offsetY}px ${tb.shadow.blur}px ${tb.shadow.color};` : ''} |
| 367 | + {isSelText ? 'outline: 2px dashed rgba(236,72,153,0.4); outline-offset: 4px;' : ''}" |
| 368 | + onclick={() => store.selectTextBlock(tb.id)} |
| 369 | + > |
| 370 | + {#if tb.arcDegrees !== 0} |
| 371 | + {@const svgW = Math.max(400, tb.fontSize * tb.text.length * 0.7)} |
| 372 | + {@const svgH = Math.max(250, tb.fontSize * 4)} |
| 373 | + {@const pathD = makeTextPath(tb.pathType, tb.arcDegrees, svgW * 0.85)} |
| 374 | + <svg style="overflow: visible; width: {svgW}px; height: {svgH}px; display: block;" viewBox="-{svgW / 2} -{svgH / 2} {svgW} {svgH}"> |
| 375 | + <defs> |
| 376 | + <path id="text-path-{tb.id}" d={pathD} /> |
| 377 | + </defs> |
| 378 | + <text fill={tb.color} font-size={tb.fontSize} font-weight={tb.fontWeight} font-family="'{tb.fontFamily}', sans-serif" letter-spacing={tb.letterSpacing} text-anchor="middle" |
| 379 | + style={tb.shadow.enabled ? `filter: drop-shadow(${tb.shadow.offsetX}px ${tb.shadow.offsetY}px ${tb.shadow.blur}px ${tb.shadow.color})` : ''}> |
| 380 | + <textPath href="#text-path-{tb.id}" startOffset="50%">{tb.text}</textPath> |
| 381 | + </text> |
| 382 | + </svg> |
| 383 | + {:else} |
| 384 | + {tb.text} |
| 385 | + {/if} |
| 386 | + </div> |
| 387 | + {/each} |
| 388 | + |
| 389 | + <!-- Legacy single text overlay below (backward compat) --> |
| 390 | + {#if store.textOverlay.enabled && store.textOverlay.text && store.textOverlay.position === 'below' && store.textBlocks.length === 0} |
289 | 391 | {@const to = store.textOverlay} |
290 | 392 | <div |
291 | 393 | class="absolute bottom-0 left-0 right-0 text-center" |
|
305 | 407 | </div> |
306 | 408 | {/if} |
307 | 409 |
|
308 | | - <!-- Text overlay custom position --> |
309 | | - {#if store.textOverlay.enabled && store.textOverlay.text && store.textOverlay.position === 'custom'} |
| 410 | + <!-- Legacy single text overlay custom (backward compat) --> |
| 411 | + {#if store.textOverlay.enabled && store.textOverlay.text && store.textOverlay.position === 'custom' && store.textBlocks.length === 0} |
310 | 412 | {@const to = store.textOverlay} |
311 | 413 | <div |
312 | 414 | class="absolute whitespace-nowrap" |
|
0 commit comments