File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,14 @@ describe('Canvas', () => {
6666
6767 expect . assertions ( 1 ) ;
6868
69- await expect ( onRenderSuccessPromise ) . resolves . toMatchObject ( [ { } ] ) ;
69+ await expect ( onRenderSuccessPromise ) . resolves . toMatchObject ( [
70+ { } ,
71+ {
72+ annotationMode : 1 ,
73+ canvasContext : expect . any ( Object ) ,
74+ viewport : page . getViewport ( { scale : 1 , rotation : 0 } ) ,
75+ } ,
76+ ] ) ;
7077
7178 restoreConsole ( ) ;
7279 } ) ;
Original file line number Diff line number Diff line change @@ -51,14 +51,14 @@ export default function Canvas(props: CanvasProps): React.ReactElement {
5151 /**
5252 * Called when a page is rendered successfully.
5353 */
54- function onRenderSuccess ( ) {
54+ function onRenderSuccess ( renderContext : RenderParameters ) {
5555 if ( ! page ) {
5656 // Impossible, but TypeScript doesn't know that
5757 return ;
5858 }
5959
6060 if ( onRenderSuccessProps ) {
61- onRenderSuccessProps ( makePageCallback ( page , scale ) ) ;
61+ onRenderSuccessProps ( makePageCallback ( page , scale ) , renderContext ) ;
6262 }
6363 }
6464
@@ -126,7 +126,7 @@ export default function Canvas(props: CanvasProps): React.ReactElement {
126126 . then ( ( ) => {
127127 canvas . style . visibility = '' ;
128128
129- onRenderSuccess ( ) ;
129+ onRenderSuccess ( renderContext ) ;
130130 } )
131131 . catch ( onRenderError ) ;
132132
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import type {
88 TypedArray ,
99 DocumentInitParameters ,
1010 RefProxy ,
11+ RenderParameters ,
1112 StructTreeNode ,
1213 TextContent ,
1314 TextItem ,
@@ -119,7 +120,7 @@ export type OnRenderAnnotationLayerSuccess = () => void;
119120
120121export type OnRenderError = OnError ;
121122
122- export type OnRenderSuccess = ( page : PageCallback ) => void ;
123+ export type OnRenderSuccess = ( page : PageCallback , renderContext : RenderParameters ) => void ;
123124
124125export type OnRenderTextLayerError = OnError ;
125126
You can’t perform that action at this time.
0 commit comments