@@ -659,46 +659,73 @@ export function LearningPathMap() {
659
659
{ /* Sprechblase mit Button (bei Hervorhebung) */ }
660
660
{ activeBubble === i && (
661
661
< g onClick = { e => e . stopPropagation ( ) } >
662
- < polygon
663
- points = { `${ cx } ,${ cy + radius - 5 } ${ cx - 20 } ,${ cy + radius + 10.49 } ${ cx + 20 } ,${ cy + radius + 10.49 } ` }
664
- fill = "rgba(255,255,255,0.9)"
665
- className = "filter drop-shadow-md"
666
- />
667
- < foreignObject
668
- x = "10%"
669
- y = { cy + radius + 10 }
670
- width = "80%"
671
- height = { bubbleHeight + 4 } // Hier wird die dynamische Höhe genutzt
672
- >
673
- < div
674
- ref = { bubbleRef } // Hier wird der Ref gesetzt, damit wir das Element messen können
675
- className = "bg-white bg-opacity-90 p-4 rounded-3xl shadow-md text-center text-sm z-100"
676
- >
677
- < p className = "font-bold mt-3 text-lg" >
678
- { el . source . title }
679
- </ p >
680
- < button
681
- className = "bg-blue-500 text-white py-2 px-4 rounded-full mt-2 hover:bg-blue-600 transition-colors"
682
- onClick = { e => {
683
- e . stopPropagation ( )
684
- setActiveBubble ( null )
685
- handleLearningPathStepClick ( getClickParams ( ) )
686
- } }
687
- >
688
- { el . solvedPercentage > 0
689
- ? el . source . type === 'challenge'
690
- ? 'Challenge weiter'
691
- : el . source . type === 'video'
692
- ? 'Video weiter'
693
- : 'Aufgabe weiter'
694
- : el . source . type === 'challenge'
695
- ? 'Challenge starten'
696
- : el . source . type === 'video'
697
- ? 'Video starten'
698
- : 'Aufgabe starten' }
699
- </ button >
700
- </ div >
701
- </ foreignObject >
662
+ { ( ( ) => {
663
+ const svgWidth = 375 // Breite des viewBox
664
+ const bubbleWidth = svgWidth * 0.8 // 80% der Breite (ca. 300px)
665
+ const margin = 15 // 15px Abstand zu beiden Rändern
666
+ const minX = margin // Minimaler x-Wert für die Bubble
667
+ const maxX = svgWidth - bubbleWidth - margin // Maximaler x-Wert
668
+ let offsetX = cx - bubbleWidth / 2 // Bubble zentriert zum Knoten
669
+
670
+ // Clamp: Sicherstellen, dass die Bubble nicht außerhalb des Bereichs gerät
671
+ if ( offsetX < minX ) offsetX = minX
672
+ if ( offsetX > maxX ) offsetX = maxX
673
+
674
+ return (
675
+ < >
676
+ { /* Pfeil (Polygon) */ }
677
+ < polygon
678
+ points = { `
679
+ ${ cx } ,${ cy + radius - 5 }
680
+ ${ cx - 20 } ,${ cy + radius + 15.6 }
681
+ ${ cx + 20 } ,${ cy + radius + 15.6 }
682
+ ` }
683
+ fill = "rgba(255,255,255,0.9)"
684
+ className = "filter drop-shadow-md"
685
+ />
686
+
687
+ { /* Bubble als foreignObject mit fester Breite und dynamischem offsetX */ }
688
+ < foreignObject
689
+ x = { offsetX }
690
+ y = { cy + radius + 15 }
691
+ width = { bubbleWidth }
692
+ height = { bubbleHeight + 4 }
693
+ >
694
+ < div
695
+ ref = { bubbleRef }
696
+ className = "h-full flex flex-col items-center justify-center
697
+ bg-white bg-opacity-90 p-4 rounded-3xl shadow-md
698
+ text-center text-sm z-100"
699
+ >
700
+ < p className = "font-bold text-lg" >
701
+ { el . source . title }
702
+ </ p >
703
+ < button
704
+ className = "bg-blue-500 text-white py-2 px-4 rounded-full mt-2
705
+ hover:bg-blue-600 transition-colors"
706
+ onClick = { e => {
707
+ e . stopPropagation ( )
708
+ setActiveBubble ( null )
709
+ handleLearningPathStepClick ( getClickParams ( ) )
710
+ } }
711
+ >
712
+ { el . solvedPercentage > 0
713
+ ? el . source . type === 'challenge'
714
+ ? 'Challenge weiter'
715
+ : el . source . type === 'video'
716
+ ? 'Video weiter'
717
+ : 'Aufgabe weiter'
718
+ : el . source . type === 'challenge'
719
+ ? 'Challenge starten'
720
+ : el . source . type === 'video'
721
+ ? 'Video starten'
722
+ : 'Aufgabe starten' }
723
+ </ button >
724
+ </ div >
725
+ </ foreignObject >
726
+ </ >
727
+ )
728
+ } ) ( ) }
702
729
</ g >
703
730
) }
704
731
@@ -815,7 +842,8 @@ export function LearningPathMap() {
815
842
cx = { cx }
816
843
cy = { cy }
817
844
r = { radius - 2 }
818
- className = "fill-gray-200/60 pointer-events-none"
845
+ //className="fill-gray-200/60 pointer-events-none"
846
+ className = "fill-[#DADADA]/80 pointer-events-none"
819
847
/>
820
848
) }
821
849
{ /* Fortschrittskreis (äußerer Kreis mit grünem Rand) */ }
0 commit comments