1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Simplify the SimpleLinkService and use it to pass in a linkService instance in DefaultAnnotationsLayerFactory

Considering that most methods of `SimpleLinkService` are complete stubs, or practically "useless" considering what they return, we can actually simplify it even more.

*Note:* This depends on the previous patch, that did a small amount of refactoring of `PDFViewer_scrollPageIntoView`, since `PDFViewer.linkService.page` is no longer accessed.

----------

Currently the `pageviewer` components example doesn't work correctly (an error is printed in the console), since no `linkService` is present when the `AnnotationsLayerBuilder` is created.

*Note:* Given that this uses the `SimpleLinkService`, clicking on e.g. internal links won't actually do anything. However, given that internal links (and similar features) are pretty much useless when only *one* page is loaded the `pageviewer` example, I don't think that really matters.
Also, using the complete `PDFLinkService` would require a `PDFViewer` instance. That would significantly complicate the example, thus making it both less clear and less self contained.
This commit is contained in:
Jonas Jenwald 2015-06-11 22:20:04 +02:00
parent ac3233bfa4
commit 4364b37e55
2 changed files with 8 additions and 10 deletions

View file

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*globals PDFJS, CustomStyle, mozL10n */
/*globals PDFJS, CustomStyle, mozL10n, SimpleLinkService */
'use strict';
@ -171,7 +171,8 @@ DefaultAnnotationsLayerFactory.prototype = {
createAnnotationsLayerBuilder: function (pageDiv, pdfPage) {
return new AnnotationsLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage
pdfPage: pdfPage,
linkService: new SimpleLinkService(),
});
}
};