Skip to content

Commit bda49f2

Browse files
이미지 모달 기능 개선. Mermaid 다이어그램의 크기 조정 및 확대/축소 기능을 추가하였으며, 새로운 다이어그램이 추가될 때 자동으로 리스너를 재설정하도록 개선하였습니다. CSS 스타일을 업데이트하여 모달의 시각적 요소와 사용자 경험을 향상시켰습니다.
1 parent 8ea8d36 commit bda49f2

2 files changed

Lines changed: 515 additions & 19 deletions

File tree

assets/css/main.css

Lines changed: 200 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,12 @@ a:hover {
945945

946946
/* Mermaid diagram in modal */
947947
.image-modal .mermaid-content {
948-
max-width: 95%;
949-
max-height: 95%;
948+
width: 90vw;
949+
height: 80vh;
950+
min-width: 600px;
951+
min-height: 400px;
952+
max-width: 95vw;
953+
max-height: 90vh;
950954
background: var(--background);
951955
border-radius: var(--radius-lg);
952956
padding: 2rem;
@@ -956,6 +960,24 @@ a:hover {
956960
transform: scale(0.8);
957961
transition: transform 0.3s ease;
958962
overflow: auto;
963+
display: flex;
964+
align-items: center;
965+
justify-content: center;
966+
}
967+
968+
/* SVG inside mermaid content should scale properly */
969+
.image-modal .mermaid-content svg {
970+
min-width: 600px !important;
971+
min-height: 400px !important;
972+
width: auto !important;
973+
height: auto !important;
974+
max-width: 100% !important;
975+
max-height: 100% !important;
976+
user-select: none;
977+
-webkit-user-select: none;
978+
-moz-user-select: none;
979+
-ms-user-select: none;
980+
transition: transform 0.3s ease-out;
959981
}
960982

961983
.image-modal.active .mermaid-content {
@@ -967,6 +989,94 @@ a:hover {
967989
border: 1px solid var(--dark-border);
968990
}
969991

992+
/* Mermaid zoom controls */
993+
.mermaid-zoom-controls {
994+
position: absolute;
995+
top: 20px;
996+
left: 20px;
997+
display: flex;
998+
flex-direction: column;
999+
gap: 8px;
1000+
z-index: 10002;
1001+
}
1002+
1003+
.zoom-btn {
1004+
width: 40px;
1005+
height: 40px;
1006+
border: 2px solid rgba(0, 0, 0, 0.8);
1007+
border-radius: 50%;
1008+
background: rgba(255, 255, 255, 0.9);
1009+
color: #333;
1010+
font-size: 16px;
1011+
cursor: pointer;
1012+
display: flex;
1013+
align-items: center;
1014+
justify-content: center;
1015+
transition: all 0.3s ease;
1016+
-webkit-backdrop-filter: blur(10px);
1017+
backdrop-filter: blur(10px);
1018+
font-weight: bold;
1019+
}
1020+
1021+
.zoom-btn:hover:not(:disabled) {
1022+
background: rgba(255, 255, 255, 1);
1023+
color: #000;
1024+
transform: scale(1.1);
1025+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
1026+
}
1027+
1028+
.zoom-btn:disabled {
1029+
opacity: 0.5;
1030+
cursor: not-allowed;
1031+
}
1032+
1033+
.zoom-btn:disabled:hover {
1034+
transform: none;
1035+
background: rgba(255, 255, 255, 0.9);
1036+
box-shadow: none;
1037+
}
1038+
1039+
[data-theme="dark"] .zoom-btn {
1040+
background: rgba(0, 0, 0, 0.8);
1041+
color: white;
1042+
border: 2px solid rgba(255, 255, 255, 0.3);
1043+
}
1044+
1045+
[data-theme="dark"] .zoom-btn:hover:not(:disabled) {
1046+
background: rgba(0, 0, 0, 0.9);
1047+
color: white;
1048+
border-color: rgba(255, 255, 255, 0.5);
1049+
box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
1050+
}
1051+
1052+
/* Mobile zoom controls */
1053+
@media (max-width: 768px) {
1054+
.image-modal .mermaid-content {
1055+
width: 95vw;
1056+
height: 85vh;
1057+
min-width: 320px;
1058+
min-height: 240px;
1059+
padding: 1rem;
1060+
}
1061+
1062+
.image-modal .mermaid-content svg {
1063+
min-width: 300px !important;
1064+
min-height: 200px !important;
1065+
}
1066+
1067+
.mermaid-zoom-controls {
1068+
top: 15px;
1069+
left: 15px;
1070+
gap: 6px;
1071+
}
1072+
1073+
.zoom-btn {
1074+
width: 35px;
1075+
height: 35px;
1076+
font-size: 14px;
1077+
}
1078+
}
1079+
9701080
/* Modal Controls */
9711081
.image-modal-close {
9721082
position: absolute;
@@ -1900,10 +2010,6 @@ a:hover {
19002010
text-align: left;
19012011
}
19022012

1903-
.share-buttons {
1904-
justify-content: center;
1905-
}
1906-
19072013
/* Mermaid 모바일 최적화 */
19082014
.post-content pre.mermaid,
19092015
.page-content pre.mermaid {
@@ -1966,3 +2072,91 @@ a:hover {
19662072
font-size: 0.8rem;
19672073
}
19682074
}
2075+
2076+
/* Enhanced Mermaid diagram click styling */
2077+
.post-content .mermaid,
2078+
.page-content .mermaid,
2079+
.post-content pre.mermaid,
2080+
.page-content pre.mermaid,
2081+
.post-content div.mermaid,
2082+
.page-content div.mermaid {
2083+
cursor: pointer !important;
2084+
transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
2085+
border-radius: 4px;
2086+
position: relative;
2087+
}
2088+
2089+
.post-content .mermaid:hover,
2090+
.page-content .mermaid:hover,
2091+
.post-content pre.mermaid:hover,
2092+
.page-content pre.mermaid:hover,
2093+
.post-content div.mermaid:hover,
2094+
.page-content div.mermaid:hover {
2095+
opacity: 0.9;
2096+
transform: scale(1.01);
2097+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
2098+
}
2099+
2100+
/* Dark mode shadow for mermaid hover */
2101+
[data-theme="dark"] .post-content .mermaid:hover,
2102+
[data-theme="dark"] .page-content .mermaid:hover,
2103+
[data-theme="dark"] .post-content pre.mermaid:hover,
2104+
[data-theme="dark"] .page-content pre.mermaid:hover,
2105+
[data-theme="dark"] .post-content div.mermaid:hover,
2106+
[data-theme="dark"] .page-content div.mermaid:hover {
2107+
box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
2108+
}
2109+
2110+
/* Ensure mermaid SVG elements don't interfere with click */
2111+
.post-content .mermaid svg,
2112+
.page-content .mermaid svg,
2113+
.post-content pre.mermaid svg,
2114+
.page-content pre.mermaid svg,
2115+
.post-content div.mermaid svg,
2116+
.page-content div.mermaid svg {
2117+
pointer-events: none; /* Let the parent handle clicks */
2118+
}
2119+
2120+
/* Add visual indicator for clickable mermaid */
2121+
.post-content .mermaid::after,
2122+
.page-content .mermaid::after,
2123+
.post-content pre.mermaid::after,
2124+
.page-content pre.mermaid::after,
2125+
.post-content div.mermaid::after,
2126+
.page-content div.mermaid::after {
2127+
content: "🔍";
2128+
position: absolute;
2129+
top: 8px;
2130+
right: 8px;
2131+
background: rgba(0, 0, 0, 0.7);
2132+
color: white;
2133+
border-radius: 50%;
2134+
width: 24px;
2135+
height: 24px;
2136+
display: flex;
2137+
align-items: center;
2138+
justify-content: center;
2139+
font-size: 12px;
2140+
opacity: 0;
2141+
transition: opacity 0.2s ease;
2142+
z-index: 10;
2143+
}
2144+
2145+
.post-content .mermaid:hover::after,
2146+
.page-content .mermaid:hover::after,
2147+
.post-content pre.mermaid:hover::after,
2148+
.page-content pre.mermaid:hover::after,
2149+
.post-content div.mermaid:hover::after,
2150+
.page-content div.mermaid:hover::after {
2151+
opacity: 1;
2152+
}
2153+
2154+
[data-theme="dark"] .post-content .mermaid::after,
2155+
[data-theme="dark"] .page-content .mermaid::after,
2156+
[data-theme="dark"] .post-content pre.mermaid::after,
2157+
[data-theme="dark"] .page-content pre.mermaid::after,
2158+
[data-theme="dark"] .post-content div.mermaid::after,
2159+
[data-theme="dark"] .page-content div.mermaid::after {
2160+
background: rgba(255, 255, 255, 0.8);
2161+
color: black;
2162+
}

0 commit comments

Comments
 (0)