feat: 增强 Mermaid 缩放功能
- 6.1 实现以鼠标为中心的缩放:滚轮缩放时自动调整滚动位置,保持鼠标指向的内容不变 - 6.2 优化缩放动画:按钮点击使用平滑过渡,滚轮缩放禁用过渡以获得更流畅的体验 - 6.3 实现智能缩放:双击图表时,默认大小放大到 2 倍,其他情况重置到 1 倍 - 6.4 优化缩放按钮状态:达到最大/最小缩放级别时自动禁用对应按钮 需求:12.1, 12.2, 12.3, 12.4, 12.5, 20.3
This commit is contained in:
35
style.css
35
style.css
@@ -921,7 +921,7 @@ article .wp-block-separator {
|
||||
animation: mermaidFadeIn 0.3s ease-in-out forwards;
|
||||
}
|
||||
|
||||
/* 需求 18.2: Mermaid 加载动画容器 */
|
||||
/* 需<EFBFBD>?18.2: Mermaid 加载动画容器 */
|
||||
.mermaid-loading {
|
||||
background: var(--color-foreground);
|
||||
border-radius: 8px;
|
||||
@@ -1034,6 +1034,12 @@ html.darkmode .mermaid-zoom-controls {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
.mermaid-zoom-btn:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.mermaid-zoom-level {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -1047,6 +1053,7 @@ html.darkmode .mermaid-zoom-controls {
|
||||
html.darkmode .mermaid-zoom-level {
|
||||
color: #aaa;
|
||||
}
|
||||
}
|
||||
|
||||
/* 按钮 tooltip */
|
||||
.mermaid-zoom-btn[title] {
|
||||
@@ -1134,7 +1141,7 @@ article.card .mermaid-container {
|
||||
margin: 20px -20px;
|
||||
}
|
||||
|
||||
/* 响应式调整 */
|
||||
/* 响应式调<EFBFBD>?*/
|
||||
@media screen and (max-width: 768px) {
|
||||
.mermaid-container {
|
||||
margin: 15px -15px;
|
||||
@@ -2503,7 +2510,7 @@ html:not(.is-home) .cover-scroll-down {
|
||||
|
||||
|
||||
|
||||
/* 左侧栏 */
|
||||
/* 左侧<EFBFBD>?*/
|
||||
|
||||
.leftbar-banner {
|
||||
|
||||
@@ -2863,7 +2870,7 @@ html.navbar-absolute #leftbar_part2.sticky {
|
||||
max-height: calc(100vh - 110px - var(--leftbar-part3-height, 0px));
|
||||
}
|
||||
|
||||
/* 只有文章目录标签需要滚动 */
|
||||
/* 只有文章目录标签需要滚<EFBFBD>?*/
|
||||
#leftbar_part2.sticky #leftbar_tab_catalog {
|
||||
max-height: calc(100vh - 200px - var(--leftbar-part3-height, 0px));
|
||||
overflow-y: auto;
|
||||
@@ -7717,7 +7724,7 @@ html.darkmode #post_comment.post-comment-force-privatemode-off .comment-post-pri
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
/*短代码 Github*/
|
||||
/*短代<EFBFBD>?Github*/
|
||||
|
||||
.github-info-card {
|
||||
|
||||
@@ -11197,7 +11204,7 @@ html.darkmode.amoled-dark #content:after {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 移动端已完成任务分隔栏 */
|
||||
/* 移动端已完成任务分隔<EFBFBD>?*/
|
||||
.mobile-todo-completed-divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -12816,7 +12823,7 @@ html.navbar-absolute #leftbar_part3.sticky {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
/* 折叠已完成按钮 */
|
||||
/* 折叠已完成按<EFBFBD>?*/
|
||||
.todo-collapse-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -14416,7 +14423,7 @@ article.post.card {
|
||||
transition: all var(--m3-motion-duration-short) var(--m3-motion-standard);
|
||||
}
|
||||
|
||||
/* M3 代码块 */
|
||||
/* M3 代码<EFBFBD>?*/
|
||||
article pre:not(.hljs-codeblock) {
|
||||
border-radius: var(--m3-shape-md) !important;
|
||||
}
|
||||
@@ -14965,7 +14972,7 @@ html.darkmode #leftbar_part2 {
|
||||
border-color: var(--themecolor);
|
||||
}
|
||||
|
||||
/* 评论项悬浮效果 */
|
||||
/* 评论项悬浮效<EFBFBD>?*/
|
||||
.comment-body {
|
||||
transition: all 0.25s ease;
|
||||
border-radius: var(--m3-shape-md);
|
||||
@@ -16923,6 +16930,12 @@ html.darkmode .mermaid-zoom-controls {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
.mermaid-zoom-btn:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.mermaid-zoom-level {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -16983,7 +16996,7 @@ html.darkmode .mermaid-container {
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
/* ---------- 响应式设计 ---------- */
|
||||
/* ---------- 响应式设<EFBFBD>?---------- */
|
||||
@media screen and (max-width: 768px) {
|
||||
.mermaid-container {
|
||||
padding: 15px;
|
||||
@@ -17149,7 +17162,7 @@ html.darkmode .mermaid-error-code pre {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* ---------- 滚动条样式(Webkit) ---------- */
|
||||
/* ---------- 滚动条样式(Webkit<EFBFBD>?---------- */
|
||||
.mermaid-container::-webkit-scrollbar {
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user