Tim van der Meij
733a58a315
Convert the thumbnail view to ES6 syntax
2017-06-04 21:32:27 +02:00
Jonas Jenwald
223c429357
Fix inconsistent spacing and trailing commas in objects in web/
files, so we can enable the comma-dangle
and object-curly-spacing
ESLint rules later on
...
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
*Please note:* This patch was created automatically, using the ESLint `--fix` command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/web/pdf_thumbnail_view.js b/web/pdf_thumbnail_view.js
index 002dbf29..1de4e530 100644
--- a/web/pdf_thumbnail_view.js
+++ b/web/pdf_thumbnail_view.js
@@ -420,8 +420,8 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
setPageLabel: function PDFThumbnailView_setPageLabel(label) {
this.pageLabel = (typeof label === 'string' ? label : null);
- this.l10n.get('thumb_page_title', { page: this.pageId, }, 'Page {{page}}').
- then((msg) => {
+ this.l10n.get('thumb_page_title', { page: this.pageId, },
+ 'Page {{page}}').then((msg) => {
this.anchor.title = msg;
});
diff --git a/web/secondary_toolbar.js b/web/secondary_toolbar.js
index 160e0410..6495fc5e 100644
--- a/web/secondary_toolbar.js
+++ b/web/secondary_toolbar.js
@@ -65,7 +65,8 @@ class SecondaryToolbar {
{ element: options.printButton, eventName: 'print', close: true, },
{ element: options.downloadButton, eventName: 'download', close: true, },
{ element: options.viewBookmarkButton, eventName: null, close: true, },
- { element: options.firstPageButton, eventName: 'firstpage', close: true, },
+ { element: options.firstPageButton, eventName: 'firstpage',
+ close: true, },
{ element: options.lastPageButton, eventName: 'lastpage', close: true, },
{ element: options.pageRotateCwButton, eventName: 'rotatecw',
close: false, },
@@ -76,7 +77,7 @@ class SecondaryToolbar {
{ element: options.cursorHandToolButton, eventName: 'switchcursortool',
eventDetails: { tool: CursorTool.HAND, }, close: true, },
{ element: options.documentPropertiesButton,
- eventName: 'documentproperties', close: true, }
+ eventName: 'documentproperties', close: true, },
];
this.items = {
firstPage: options.firstPageButton,
```
2017-06-01 12:47:47 +02:00
Yury Delendik
5438ce9b98
Wraps mozL10n to async calls; splits firefox and generic l10n libs.
2017-05-31 09:22:25 -05:00
Yury Delendik
1e6f49b129
Merge pull request #8462 from yurydelendik/rm=umd
...
Removes last UMDs from the modules.
2017-05-31 07:27:19 -05:00
Yury Delendik
66c8893815
Removes last UMDs from the modules.
2017-05-31 07:14:17 -05:00
Jonas Jenwald
92529e2b11
Refactor the getTempCanvas
function in pdf_thumbnail_view.js
to a factory, in preparation for ES6 conversion of the thumbnail related code
...
This patch intends to simplify future ES6 refactoring of the thumbnail code, since the current code isn't going to work well together with proper `Class`es.
2017-05-31 00:18:06 +02:00
Jonas Jenwald
a9e5bc91fb
Replace unnecessary var self = this
statements with arrow functions in web/pdf_page_view.js
and web/pdf_thumbnail_view.js
...
Also replaces `var` with `let` in code that's touched in the patch. Please note that this should be completely safe, for two separate reasons, since trying to access let in a scope where it's not defined is first of all a runtime error and second of all an ESLint error (thanks to the `no-undef` rule).
2017-05-16 13:48:27 +02:00
Jonas Jenwald
b0a4f6de8f
Use createPromiseCapability
in /web
files
...
In various viewer files, there's a number of cases where we basically duplicate the functionality of `createPromiseCapability` manually.
As far as I can tell, a couple of these cases have existed for a very long time, and notable even before the `createPromiseCapability` utility function existed.
Also, since we can write ES6 code now, the patch also replaces a couple of `bind` usages with arrow functions in code that's touched in the patch.
2017-04-16 12:45:24 +02:00
Jonas Jenwald
db6f2f3718
Ensure that PDFThumbnailView.draw
is able to handle RenderingCancelledException
correctly (PR 8157 follow-up)
...
In PR 8157, I embarrassingly enough forgot to change `pdf_thumbnail_view.js` to match the changes made to `pdf_page_view.js`.
2017-04-15 11:12:48 +02:00
Yury Delendik
8e681ce3e2
Change amd to cjs path in ES6 modules
2017-04-14 10:32:36 -05:00
Jonas Jenwald
3b35c15d42
Convert the files in the /web
folder to ES6 modules
...
Note that as discussed on IRC, this makes the viewer slightly slower to load *only* in `gulp server` mode, however the difference seem slight enough that I think it will be fine.
2017-04-09 11:55:48 +02:00
Dave House
52360694b0
Remove ids from viewer page and thumbnail divs
...
The id, and parsing it for the page number, is replaced by the
data-page-number attribute (added here for thumbnails).
2017-01-23 07:46:39 -07:00
Jonas Jenwald
efb9619e53
Add PageLabels to PDFPageView
and PDFThumbnailView
2016-10-26 13:30:37 +02:00
Yury Delendik
0576c9c6c6
Replaces all preprocessor directives with PDFJSDev calls.
2016-10-14 10:57:53 -05:00
Jonas Jenwald
a824c6c4f6
Ensure that any pending rendering operations in PDFViewer
/PDFThumbnailViewer
are cancelled when the viewer is closed
2016-10-11 22:01:22 +02:00
Yury Delendik
006e8fb59d
Introduces UMD headers to the web/ folder.
2016-04-13 10:09:48 -05:00
Jonas Jenwald
b5582e14a9
[PDFThumbnailView] Re-factor the canvas
to image
conversion such that we always render to a canvas
, and then replace it with an image
once rendering is done
...
*This is a follow-up to PRs 6299 and 6441.*
The patch also adds an option to `PDFThumbnailView`, that disables the canvas-to-image conversion entirely, which might be useful in the context of issue 7026.
2016-02-28 18:18:12 +01:00
Jonas Jenwald
95aa8b0415
Remove the hasImage
property from PDFThumbnailView
...
The `hasImage` property is a left-over from older thumbnail code, and has been made obsolete by `renderingState`.
Having two different properties tracking (basically) the same state is asking for trouble, since it's very easy to forget to update one of them, with annoying bugs as the result.
2016-02-25 17:04:11 +01:00
Yury Delendik
194994a289
Merge pull request #6551 from yurydelendik/subaa
...
[api-minor] Enables subpixel anti-aliasing for most of the content.
2015-11-17 19:45:32 -06:00
Yury Delendik
1d8800370a
Allow subpixel anti-aliasing for most of the content.
2015-11-16 10:50:02 -06:00
Manas
a2ba1b8189
Uses editorconfig to maintain consistent coding styles
...
Removes the following as they unnecessary
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
2015-11-14 07:32:18 +05:30
Yury Delendik
5135aa9bec
Adds deprecation warning for the API calls.
2015-10-23 09:06:32 -05:00
Jonas Jenwald
1b50932eaa
Don't show thumbnails until the canvas
to image
conversion is done (issue 6442)
2015-09-12 12:05:40 +02:00
Jonas Jenwald
d7a90d83de
Delete, and clear, the image
in PDFThumbnailView_reset
...
*Follow-up to PR 6299.*
2015-09-11 14:12:58 +02:00
Jonas Jenwald
555c7925a0
Prevent setImage
from failing to display small thumbnails, by adding a missing canvas
to image
conversion
...
*Follow-up to PR 6299.*
2015-09-11 14:12:57 +02:00
Jonas Jenwald
ebce928149
Extract the conversion from canvas
to image
into a helper function in PDFThumbnailView
...
*Follow-up to PR 6299.*
This patch reduces unnecessary code duplication for the `canvas` to `image` conversion. It also does a bit of re-ordering (and adds new lines) in `_getPageDrawContext`, since that function currently is a bit hard to read.
2015-09-11 14:12:48 +02:00
awang
161def7f4e
Convert canvas thumbnails to PNG #6299
2015-09-04 09:58:47 +08:00
Mike Corbin
357ee6cbb2
viewer: Support Retina/HiDPI thumbnails
...
Reuse the existing getOutputScale() machinery to render and/or rescale
thumbnail images to the native display resolution. Fixes blurry thumbnails on
HiDPI displays making it a lot easier to make out the content.
2015-05-18 15:13:46 +01:00
Jonas Jenwald
eed67ea8bb
Remove the |el| property in PDFPageView and PDFThumbnailView
2015-02-27 00:26:02 +01:00
Jonas Jenwald
777d69b52e
Remove dead code from PDFThumbnailView
2015-01-26 20:52:46 +01:00
Jonas Jenwald
b7041f81f4
Enable cancelling of thumbnail drawing
...
This is useful if thumbnails are being rendered when the document is rotated, since it let us abort the current rendering.
2015-01-26 20:52:45 +01:00
Jonas Jenwald
878aa76c15
Refactor PDFThumbnailView to look more similar to PDFPageView
...
This includes an optimization to zero the height and width of existing thumbnail canvases, when they are removed and recreated during rotation of the document. (Credit goes to nnethercote, who initially found this in PR 4920.)
2015-01-26 20:52:45 +01:00
Jonas Jenwald
7f8f404536
Rename ThumbnailView to PDFThumbnailView and refactor it to be more class-like
2015-01-26 20:52:44 +01:00
Jonas Jenwald
64ba38008f
Rename the thumbnail_view.js file
2015-01-25 17:21:53 +01:00