feat(typesetting): Wave 1 - 对齐修复+底部对齐、封面页字号豁免、字号UI改造

- 修复对齐按钮缺少click handler的缺陷,新增事件委托
- 三态对齐切换: 居顶(↑) -> 居中(↕) -> 居底(↓)
- 封面页和尾页通过CSS变量重置不受全局fontScale影响
- 字号控制从slider改为dropdown+自定义输入,预设0.5/0.8/1.0/1.2/1.5/2.0
This commit is contained in:
augushong
2026-05-16 00:23:36 +08:00
committed by Atlas
parent b8c05e0329
commit 2b9bfb179f
3 changed files with 106 additions and 20 deletions

View File

@@ -112,6 +112,7 @@
/* --- 封面页/首页 --- */
.page-cover {
--pi-font-scale: 1 !important;
display: flex;
flex-direction: column;
justify-content: center;
@@ -335,6 +336,7 @@
/* --- 总结页/尾页 --- */
.page-summary {
--pi-font-scale: 1 !important;
display: flex;
flex-direction: column;
justify-content: center;
@@ -417,6 +419,12 @@
justify-content: center;
}
.page-body.valign-bottom .page-content {
display: flex;
flex-direction: column;
justify-content: flex-end;
}
/* ============================================
Content Flow (中间栏内容流)
所有元素按实际尺寸纵向排列

View File

@@ -897,7 +897,12 @@ var PhoneImageEngine = (function () {
function generateContentPage(blocks, pageNum, sizeConfig, isLast) {
// 读取逐页对齐配置
var alignment = (config.pageAlignments && config.pageAlignments[pageNum]) || 'top';
var valignClass = alignment === 'center' ? ' valign-center' : '';
var valignClass = '';
if (alignment === 'center') {
valignClass = ' valign-center';
} else if (alignment === 'bottom') {
valignClass = ' valign-bottom';
}
var html = '<div class="phone-image-page page-body' + valignClass + '" style="width:' +
sizeConfig.width + 'px;height:' + sizeConfig.height + 'px;">';
@@ -1230,8 +1235,11 @@ var PhoneImageEngine = (function () {
var pageNum = pages[i].pageNum || (i);
var currentAlign = (config.pageAlignments && config.pageAlignments[pageNum]) || 'top';
var isActiveCenter = currentAlign === 'center';
var $toggle = $('<button class="thumb-alignment-toggle' + (isActiveCenter ? ' active-center' : '') + '" data-page-index="' + i + '" data-page-num="' + pageNum + '">' +
(isActiveCenter ? '\u2195' : '\u2191') +
var isActiveBottom = currentAlign === 'bottom';
var activeClass = isActiveCenter ? ' active-center' : (isActiveBottom ? ' active-bottom' : '');
var symbol = isActiveCenter ? '\u2195' : (isActiveBottom ? '\u2193' : '\u2191');
var $toggle = $('<button class="thumb-alignment-toggle' + activeClass + '" data-page-index="' + i + '" data-page-num="' + pageNum + '">' +
symbol +
'</button>');
$item.append($toggle);
}
@@ -1580,6 +1588,26 @@ var PhoneImageEngine = (function () {
return div.innerHTML;
}
// ===== 对齐按钮事件委托 =====
$(document).on('click', '.thumb-alignment-toggle', function () {
var $btn = $(this);
var pageNum = parseInt($btn.attr('data-page-num'), 10);
var currentAlign = (config.pageAlignments && config.pageAlignments[pageNum]) || 'top';
// 三态循环: top -> center -> bottom -> top
var nextAlign;
if (currentAlign === 'top') {
nextAlign = 'center';
} else if (currentAlign === 'center') {
nextAlign = 'bottom';
} else {
nextAlign = 'top';
}
setPageAlignment(pageNum, nextAlign);
render();
});
// ===== 公开API =====
return {
init: init,