@@ -487,22 +487,22 @@ const createDiagram = () => {
487
487
const g = svg .append (' g' )
488
488
489
489
// Apply initial zoom to see all content
490
- const initialScale = 0.55 // Further reduced scale to see more content
490
+ const initialScale = 0.6 // Increased zoom by 10%
491
491
svg .call (zoom .transform , d3 .zoomIdentity .translate (width / 2 - width * initialScale / 2 , 10 ).scale (initialScale ))
492
492
493
493
// Set initial positions for models based on the reference image layout
494
494
const initialPositions: Record <string , {x: number , y: number }> = {
495
495
// Top row - more evenly spaced
496
- ' team' : { x: width * 0.2 , y: 150 },
496
+ ' team' : { x: width * 0.1 , y: 150 },
497
497
' user' : { x: width * 0.5 , y: 150 },
498
498
' post' : { x: width * 0.8 , y: 150 },
499
499
500
500
// Second row - better distributed
501
- ' accessToken' : { x: width * 0.2 , y: 500 }, // Moved down to avoid overlapping
501
+ ' accessToken' : { x: width * 0.1 , y: 550 }, // Further moved down to avoid overlapping
502
502
' subscriber' : { x: width * 0.8 , y: 450 },
503
503
504
504
// Third row - more evenly spaced
505
- ' project' : { x: width * 0.2 , y: 750 },
505
+ ' project' : { x: width * 0.2 , y: 1400 },
506
506
' order' : { x: width * 0.5 , y: 750 },
507
507
' subscriberEmail' : { x: width * 0.8 , y: 750 },
508
508
@@ -584,9 +584,9 @@ const createDiagram = () => {
584
584
node .append (' rect' )
585
585
.attr (' width' , cardWidth )
586
586
.attr (' height' , d => {
587
- const propsHeight = d .properties .length * 24
588
- const relationshipsHeight = d .relationships .length * 24 + 10
589
- return 60 + propsHeight + relationshipsHeight
587
+ const propsHeight = d .properties .length * 22 // Reduced from 24
588
+ const relationshipsHeight = d .relationships .length > 0 ? ( d . relationships . length * 22 + 20 ) : 0 // Reduced from 24
589
+ return 50 + propsHeight + relationshipsHeight // Reduced from 60
590
590
})
591
591
.attr (' rx' , 8 )
592
592
.attr (' ry' , 8 )
@@ -598,10 +598,10 @@ const createDiagram = () => {
598
598
node .append (' rect' )
599
599
.attr (' width' , cardWidth )
600
600
.attr (' height' , d => {
601
- // Calculate height based on properties and relationships
602
- const propsHeight = d .properties .length * 24
603
- const relationshipsHeight = d .relationships .length * 24 + 10
604
- return 60 + propsHeight + relationshipsHeight
601
+ // Calculate height based on properties and relationships with reduced height
602
+ const propsHeight = d .properties .length * 22 // Reduced from 24
603
+ const relationshipsHeight = d .relationships .length > 0 ? ( d . relationships . length * 22 + 20 ) : 0 // Reduced from 24
604
+ return 50 + propsHeight + relationshipsHeight // Reduced from 60
605
605
})
606
606
.attr (' rx' , 8 )
607
607
.attr (' ry' , 8 )
@@ -618,23 +618,23 @@ const createDiagram = () => {
618
618
// Header background
619
619
header .append (' rect' )
620
620
.attr (' width' , cardWidth )
621
- .attr (' height' , 40 )
621
+ .attr (' height' , 36 ) // Reduced from 40
622
622
.attr (' rx' , 8 )
623
623
.attr (' ry' , 8 )
624
624
.attr (' fill' , ' #1E293B' )
625
625
626
626
// Emoji
627
627
header .append (' text' )
628
628
.attr (' x' , 20 )
629
- .attr (' y' , 25 )
629
+ .attr (' y' , 22 ) // Adjusted from 25
630
630
.attr (' dominant-baseline' , ' middle' )
631
- .attr (' font-size' , ' 20px ' )
631
+ .attr (' font-size' , ' 18px ' ) // Reduced from 20px
632
632
.text (d .emoji )
633
633
634
634
// Model name
635
635
header .append (' text' )
636
636
.attr (' x' , 50 )
637
- .attr (' y' , 25 )
637
+ .attr (' y' , 22 ) // Adjusted from 25
638
638
.attr (' dominant-baseline' , ' middle' )
639
639
.attr (' fill' , ' #E5E7EB' )
640
640
.attr (' font-weight' , ' bold' )
@@ -647,11 +647,11 @@ const createDiagram = () => {
647
647
648
648
// Properties container
649
649
const propertiesGroup = g .append (' g' )
650
- .attr (' transform' , ' translate(0, 40 )' )
650
+ .attr (' transform' , ' translate(0, 36 )' ) // Reduced from 40
651
651
652
652
// Add properties
653
653
d .properties .forEach ((prop , i ) => {
654
- const y = 20 + i * 24
654
+ const y = 18 + i * 22 // Reduced from 20 and 24
655
655
const row = propertiesGroup .append (' g' )
656
656
.attr (' transform' , ` translate(0, ${y }) ` )
657
657
@@ -696,7 +696,7 @@ const createDiagram = () => {
696
696
697
697
// Add relationships section if there are any
698
698
if (d .relationships .length > 0 ) {
699
- const relationshipsY = 40 + d .properties .length * 24
699
+ const relationshipsY = 36 + d .properties .length * 22 // Adjusted from 40 and 24
700
700
701
701
// Add relationship divider line
702
702
g .append (' line' )
@@ -714,7 +714,7 @@ const createDiagram = () => {
714
714
715
715
// Add each relationship on its own row
716
716
d .relationships .forEach ((rel , i ) => {
717
- const y = 20 + i * 24
717
+ const y = 18 + i * 22 // Reduced from 20 and 24
718
718
const row = relationshipsGroup .append (' g' )
719
719
.attr (' transform' , ` translate(0, ${y }) ` )
720
720
@@ -805,15 +805,15 @@ const createDiagram = () => {
805
805
806
806
// Add a legend for relationship types with improved visibility
807
807
const legend = svg .append (' g' )
808
- .attr (' transform' , ` translate(${width - 220 }, 40 ) ` ) // Moved down to center vertically
808
+ .attr (' transform' , ` translate(${width - 220 }, 50 ) ` ) // Moved down more to center vertically
809
809
.attr (' class' , ' legend' )
810
810
811
811
// Add legend background for better visibility
812
812
legend .append (' rect' )
813
813
.attr (' x' , - 10 )
814
814
.attr (' y' , - 10 )
815
815
.attr (' width' , 220 )
816
- .attr (' height' , 130 )
816
+ .attr (' height' , 120 ) // Reduced height to balance spacing
817
817
.attr (' rx' , 8 )
818
818
.attr (' ry' , 8 )
819
819
.attr (' fill' , ' rgba(30, 41, 59, 0.8)' ) // Dark background with transparency
0 commit comments