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
66c8893815
Removes last UMDs from the modules.
2017-05-31 07:14:17 -05:00
Jonas Jenwald
f27b5013e2
Replace unnecessary bind(this)
statements with arrow functions in web/
files
...
By using `let`, which is block-scoped, instead of `var` in a couple of places we're able to get rid of additional `bind` calls.
2017-05-04 17:13:09 +02:00
Jonas Jenwald
2a0207ccaf
Enable the object-shorthand
ESLint rule in web
...
Please see http://eslint.org/docs/rules/object-shorthand .
For the most part, these changes are of the search-and-replace kind, and the previously enabled `no-undef` rule should complement the tests in helping ensure that no stupid errors crept into to the patch.
2017-04-29 20:29:04 +02:00
Jonas Jenwald
79e0745a12
Import getGlobalEventBus
correctly from web/dom_events.js
in various /web
files, to un-break e.g. the viewer components (PR 8203 follow-up)
...
In PR 8203, I somehow managed to mess up the import of `getGlobalEventBus` in *all* files where it's present; my sincere apologies for this!
2017-04-17 00:54:29 +02:00
Yury Delendik
8e681ce3e2
Change amd to cjs path in ES6 modules
2017-04-14 10:32:36 -05:00
Jonas Jenwald
b2c3f8f081
Convert a number of import * as pdfjsLib from 'pdfjs-web/pdfjs';
cases to only specify the necessary imports
...
Rather than always importing everything from the `web/pdfjs.js`, similar to all other imports we can just choose what we actually need.
2017-04-09 11:55:48 +02: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
Yury Delendik
0576c9c6c6
Replaces all preprocessor directives with PDFJSDev calls.
2016-10-14 10:57:53 -05:00
Jonas Jenwald
885ba83624
Add the number of textDivs
to the textlayerrendered
event, to avoid having to manually get that information in the event handler
2016-10-11 22:36:02 +02:00
Jonas Jenwald
3904be8889
Ensure that we cancel any pending textLayer
rendering operations when the viewer is closed (issue 7274)
2016-10-11 22:01:22 +02:00
Jeremy Press
e68f4f855f
fixing 7590 by delaying div shrink after mouse up
2016-09-09 13:55:19 -07:00
Tim van der Meij
a2525a8ba3
Revert "Add a enhanceTextSelection
preference to the viewer"
...
This reverts commit 15e45d772f
.
2016-09-03 20:26:46 +02:00
Jonas Jenwald
15e45d772f
Add a enhanceTextSelection
preference to the viewer
2016-09-02 14:38:51 +02:00
Tim van der Meij
7c961b6b7a
Minor code style improvements after #7539
2016-09-01 18:07:12 +02:00
Jeremy Press
6faa84abdb
Continuing fairexpand #6663
...
1. Expanding divs to improve text selection. (Yury)
2. Adding enhanceTextSelection as an option.
3. Moving feature functionality from text_layer_builder.js to text_layer.js.
4. Added expandTextDivs method to only load expanded divs on first click, and only show on subsequent clicks
2016-08-31 09:54:52 -07:00
Yury Delendik
5aefce6ba6
Merge pull request #5579 from jazzy-em/master
...
Added multiple term search functionality (with default phrase search)
2016-05-27 14:23:26 -05:00
jazzy-em
0a347ec04d
Added multiple term search functionality (with default phrase search)
2016-05-26 18:24:58 +05:00
Tim van der Meij
6a7012aaca
Remove unused variables
...
These have been found using `gulp lint` in combination with the `unused:
true` parameter for JSHint. Unfortunately there are too many false
positives to enable this feature, but now that most globals have been
removed because of the conversion to UMD the results are much more
useful than before.
2016-05-11 16:11:13 +02:00
Yury Delendik
7fd3db9977
Adds EventBus.
2016-04-28 06:57:24 -05:00
Yury Delendik
4165cedc9f
Replace pdfjsLib with module that represents pdf.js.
2016-04-13 10:11:34 -05:00
Yury Delendik
006e8fb59d
Introduces UMD headers to the web/ folder.
2016-04-13 10:09:48 -05:00
Yury Delendik
1e3e14e6b2
Exposes all functional members via lib exports and use them in viewer.
2016-04-07 13:46:07 -05:00
Yury Delendik
56ccaea99b
Move text layer building logic into src/display/text_layer.js
2015-11-19 10:50:27 -06:00
Yury Delendik
2f34fd46cb
Move CustomStyle.
2015-11-19 10:47:17 -06: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
b8ad68af25
Non/less flashing text layer during selection.
2015-11-05 10:48:22 -06:00
Rob Wu
47f2c14723
Optimize text layer: Avoid unneeded .textContent
...
Built-in DOM properties are slower than plain JS properties.
A few lines before, textContent is assigned as follows:
textDiv.textContent = geom.str;
So replacing textDiv.textContent.length with geom.str.length slightly
improves performance without side effects.
2015-07-25 10:55:00 +02:00
Jonas Jenwald
3f061cef86
Add a |textlayerrendered| event
2015-01-06 17:57:32 +01:00
Yury Delendik
2565e627a3
Refactors draw method in PDFPageView; makes optional some PDFPageViewOptions options
2014-12-20 23:41:34 -06:00
Yury Delendik
2ac7ac4678
Removes lastScrollSource and isViewerInPresentationMode from TextLayerBuilderOptions
2014-12-20 11:14:13 -06:00
Yury Delendik
a89bba35b2
Adds types definitions (jsdoc) for the PDFViewer code.
2014-09-28 10:39:56 -05:00
Nicholas Nethercote
cd61aad24f
Don't scale single-char text divs.
...
This change makes scrolling noticeably smoother on files with many
single-char text divs, such as the one in #1045 . The trade-off is that
the visual appearance of text selection in such documents is slightly
worse, because more text divs overlap.
This change also uses `scaleX(N)` instead of `scale(N, 1)`. This might
be marginally more efficient in terms of JS string concatenation.
2014-08-20 19:34:33 -07:00
Fabian Lange
6a0aa2cf49
Set transformOrigin for text layer in css.
...
transformOrigin is set to 0% 0% in all cases. This adds extra memory
impact into the dom tree. It also involves the CustomStyles workaround
to determine the correct css rule for the browser.
By setting all vendor and standard variants in css, the rule is applied
without the dom memory overhead and without the minor computation
overhead to set the value.
2014-08-19 22:46:09 +02:00
Yury Delendik
4ef70588de
Merge pull request #5193 from nnethercote/data-font-name
...
Only use data-font-name attributes when necessary.
2014-08-18 13:54:07 -05:00
Nicholas Nethercote
eda7dcbb9e
Only use data-font-name attributes when necessary.
...
The data-font-name attribute of textLayer divs are only used by the Font
Inspector. This change ensures they are only present when the pdfBug
tools are enabled.
2014-08-17 15:56:11 -07:00
Nicholas Nethercote
9695958ebc
Remove position: absolute
from text divs.
...
It's not necessary in each text div, because it's specified in the
`.textLayer > div` rule.
2014-08-15 08:17:20 -07:00
Nicholas Nethercote
be29fc44e0
Avoid repeated creation of a simple RegExp object.
2014-08-07 22:08:23 -07:00
Yury Delendik
e8af56ffc5
Fixes text-selection example
2014-08-06 10:09:27 -05:00
Yury Delendik
666cf02f91
Merge pull request #5137 from CodingFabian/optimize-textbuilder-renderLayer
...
Optimize TextLayerBuilder_renderLayer() for text heavy documents.
2014-08-06 09:09:32 -05:00
Fabian Lange
39129fc441
Optimize TextLayerBuilder_renderLayer() for text heavy documents.
...
This change improves the text layer creation of "normal" text heavy documents.
It changes 2 things:
* If the text element is not rotated, it will neither calculate nor apply a
textTransform: rotate(0deg) to the text layer element.
* For scaling the text layer div, the context will measure the width of the
text in the given font. For many text documents the font changes seldom.
If the font stays the same, the context does not need to be set to a new font
especially avoiding the temporary creation of the same font string over and
over again.
2014-08-06 00:40:48 +02:00
Tim van der Meij
dbe22475e1
Converting PDFFindBar and PDFFindController to classes
2014-07-29 21:59:01 +02:00
Tim van der Meij
fa33b9c643
Refactoring PDFFindController in the text layer builder
2014-06-23 22:19:18 +02:00
Tim van der Meij
a968da8887
Convert the text layer builder to a class
2014-06-23 22:07:21 +02:00
Tim van der Meij
2a052c4aad
Refactoring text layer builder
2014-06-23 21:40:37 +02:00
Rob Wu
d7dfa447cd
Remove unused (local) variables in web/
2014-04-15 17:10:23 +02:00
Manuel Braun
e7da8edb91
Refactoring - remove duplicated code in TextLayerBuilder
2014-04-14 19:05:21 +02:00
Yury Delendik
f6c631bc31
Reverts #4556 due to flicker on Chome
2014-04-11 14:07:36 -05:00