Commit fac33607 authored by liujiangnan's avatar liujiangnan

fix

parent a125aaf4
...@@ -14,7 +14,7 @@ $(function () { ...@@ -14,7 +14,7 @@ $(function () {
} else { } else {
console.log('获取到数据:', data); console.log('获取到数据:', data);
if (!data.continuity) { if (!data.continuity) {
data.continuity = data.pages.map((item,i)=>{return i+''}); data.continuity = data.pages.map((item, i) => { return i + '' });
} }
initializeApp(data); initializeApp(data);
} }
...@@ -152,12 +152,12 @@ function initializeApp(data) { ...@@ -152,12 +152,12 @@ function initializeApp(data) {
let endTime = group.end; let endTime = group.end;
// 如果时间信息为空,使用页面级别的时间 // 如果时间信息为空,使用页面级别的时间
if (startTime === null || startTime === undefined) { // if (startTime === null || startTime === undefined) {
startTime = page.start || 0; // startTime = page.start;
} // }
if (endTime === null || endTime === undefined) { // if (endTime === null || endTime === undefined) {
endTime = page.end || 0; // endTime = page.end;
} // }
group.group.forEach((textGroup, textIndex) => { group.group.forEach((textGroup, textIndex) => {
if (textGroup && textGroup.rect) { if (textGroup && textGroup.rect) {
...@@ -413,26 +413,15 @@ function initializeApp(data) { ...@@ -413,26 +413,15 @@ function initializeApp(data) {
// 遍历所有矩形框,检查时间 // 遍历所有矩形框,检查时间
allRects.forEach(rect => { allRects.forEach(rect => {
if (currentTime >= rect._start && currentTime <= rect._end) { if (rect._start != null && rect._end != null && currentTime >= rect._start && currentTime <= rect._end) {
newRects.push(rect); newRects.push(rect);
} }
}); });
// 遍历所有单词,检查时间 // 遍历所有单词,检查时间
allWords.forEach(word => { allWords.forEach(word => {
let wordStart = word.start;
let wordEnd = word.end;
// 为没有时间信息的单词设置默认时间
if (wordStart === null || wordStart === undefined) {
wordStart = word._start || 0;
}
if (wordEnd === null || wordEnd === undefined) {
wordEnd = word._end || 0;
}
// 如果当前时间已经过了这个单词的开始时间,就保持高亮直到切换页面 // 如果当前时间已经过了这个单词的开始时间,就保持高亮直到切换页面
if (currentTime >= wordStart) { if (word.start != null && currentTime >= word.start) {
newWords.push(word); newWords.push(word);
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment