Merge pull request #20425 from calixteman/only_parese_parenttree_one_time
Create the number tree for the ParentTree only one time
This commit is contained in:
commit
2201777d0f
@ -42,6 +42,7 @@ class StructTreeRoot {
|
||||
this.roleMap = new Map();
|
||||
this.structParentIds = null;
|
||||
this.kidRefToPosition = undefined;
|
||||
this.parentTree = null;
|
||||
}
|
||||
|
||||
getKidPosition(kidRef) {
|
||||
@ -70,6 +71,11 @@ class StructTreeRoot {
|
||||
|
||||
init() {
|
||||
this.readRoleMap();
|
||||
const parentTree = this.dict.get("ParentTree");
|
||||
if (!parentTree) {
|
||||
return;
|
||||
}
|
||||
this.parentTree = new NumberTree(parentTree, this.xref);
|
||||
}
|
||||
|
||||
#addIdToPage(pageRef, id, type) {
|
||||
@ -771,7 +777,7 @@ class StructTreePage {
|
||||
return;
|
||||
}
|
||||
|
||||
const parentTree = this.rootDict.get("ParentTree");
|
||||
const { parentTree } = this.root;
|
||||
if (!parentTree) {
|
||||
return;
|
||||
}
|
||||
@ -782,10 +788,9 @@ class StructTreePage {
|
||||
}
|
||||
|
||||
const map = new Map();
|
||||
const numberTree = new NumberTree(parentTree, this.xref);
|
||||
|
||||
if (Number.isInteger(id)) {
|
||||
const parentArray = numberTree.get(id);
|
||||
const parentArray = parentTree.get(id);
|
||||
if (Array.isArray(parentArray)) {
|
||||
for (const ref of parentArray) {
|
||||
if (ref instanceof Ref) {
|
||||
@ -799,7 +804,7 @@ class StructTreePage {
|
||||
return;
|
||||
}
|
||||
for (const [elemId, type] of ids) {
|
||||
const obj = numberTree.get(elemId);
|
||||
const obj = parentTree.get(elemId);
|
||||
if (obj) {
|
||||
const elem = this.addNode(this.xref.fetchIfRef(obj), map);
|
||||
if (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user