-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I've been looking at implementing hyperlinks within PdfListView. External links are easy, since we just get the href and turn it into a normal HTML hyperlink. Internal links are a bit trickier because they need to change the view of the top level ListView. At the moment I've created an AnnotationsLayerBuilder, very similar in structure to TextLayerBuilder (see commit jpallen@3d121f2). This means it's nested in the stack like PdfListView -> ListView -> PageContainerView -> PageView -> Page -> AnnotationsLayerBuidler, where each class doesn't have access or knowledge about the class above. This is a problem however, since AnnotationsLayerBuilder needs to be able to call PdfListView to tell it to go to a certain destination.
One solution, that fits well with modular structure, would be to have custom AnnotationsLayerBuilder for each instance of PdfListView. I.e.
pdfListView = new PdfListView();
AnnotationsLayerBuilder = AnnotationLayerBuilderBuilder(pdfListView); # :(
pdfListView.listView.options.annotationLayerBuilder = AnnotationLayerBuilder;
Then the instances of AnnotationsLayerBuilder at the end of the chain will have knowledge about the top level PdfListView without needing to pass the PdfListView object all the way down the chain.
It's not pretty, but I can't think of a solution that is. Thoughts?