aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/PDFBox.tsx
diff options
context:
space:
mode:
authormadelinegr <monika_hedman@brown.edu>2019-06-11 12:54:05 -0400
committermadelinegr <monika_hedman@brown.edu>2019-06-11 12:54:05 -0400
commitf4a545e6e4b21ca28ce861325be69d920578d6c0 (patch)
tree6adbd99ea734c3bfff9a86f7c4f0904831579dc7 /src/client/views/nodes/PDFBox.tsx
parent0f9ae31c6a6f384b2b8df9223a820c2d53571d3a (diff)
parent06d5bb5c65da6f4a115ebf8118989115420bccef (diff)
pulled from master
Diffstat (limited to 'src/client/views/nodes/PDFBox.tsx')
-rw-r--r--src/client/views/nodes/PDFBox.tsx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx
index b1fd54df1..05088f688 100644
--- a/src/client/views/nodes/PDFBox.tsx
+++ b/src/client/views/nodes/PDFBox.tsx
@@ -68,20 +68,21 @@ export class PDFBox extends DocComponent<FieldViewProps, PdfDocument>(PdfDocumen
@observable private _currAnno: any = [];
@observable private _interactive: boolean = false;
- @observable private _loaded: boolean = false;
@computed private get curPage() { return NumCast(this.Document.curPage, 1); }
@computed private get thumbnailPage() { return NumCast(this.props.Document.thumbnailPage, -1); }
componentDidMount() {
- let wasSelected = this.props.isSelected();
+ let wasSelected = this.props.active();
this._reactionDisposer = reaction(
- () => [this.props.isSelected(), this.curPage],
+ () => [this.props.active(), this.curPage],
() => {
- if (this.curPage > 0 && !this.props.isTopMost && this.curPage !== this.thumbnailPage && wasSelected && !this.props.isSelected()) {
- this.saveThumbnail();
- }
- wasSelected = this._interactive = this.props.isSelected();
+ setTimeout(action(() => { // this forces the active() check to happen after all changes in a transaction have occurred.
+ if (this.curPage > 0 && !this.props.isTopMost && this.curPage !== this.thumbnailPage && wasSelected && !this.props.active()) {
+ this.saveThumbnail();
+ }
+ wasSelected = this._interactive = this.props.active();
+ }), 0);
},
{ fireImmediately: true });
@@ -276,7 +277,6 @@ export class PDFBox extends DocComponent<FieldViewProps, PdfDocument>(PdfDocumen
if (this._perPageInfo.length === 0) { //Makes sure it only runs once
this._perPageInfo = [...Array(page._transport.numPages)];
}
- this._loaded = true;
}
@action