@@ -1699,10 +1699,7 @@ class MarkupAnnotation extends Annotation {
16991699 fillAlpha,
17001700 pointsCallback,
17011701 } ) {
1702- let minX = Number . MAX_VALUE ;
1703- let minY = Number . MAX_VALUE ;
1704- let maxX = Number . MIN_VALUE ;
1705- let maxY = Number . MIN_VALUE ;
1702+ const bbox = ( this . data . rect = [ Infinity , Infinity , - Infinity , - Infinity ] ) ;
17061703
17071704 const buffer = [ "q" ] ;
17081705 if ( extra ) {
@@ -1732,14 +1729,8 @@ class MarkupAnnotation extends Annotation {
17321729 ] ) ;
17331730
17341731 for ( let i = 0 , ii = pointsArray . length ; i < ii ; i += 8 ) {
1735- const [ mX , MX , mY , MY ] = pointsCallback (
1736- buffer ,
1737- pointsArray . subarray ( i , i + 8 )
1738- ) ;
1739- minX = Math . min ( minX , mX ) ;
1740- maxX = Math . max ( maxX , MX ) ;
1741- minY = Math . min ( minY , mY ) ;
1742- maxY = Math . max ( maxY , MY ) ;
1732+ const points = pointsCallback ( buffer , pointsArray . subarray ( i , i + 8 ) ) ;
1733+ Util . rectBoundingBox ( ...points , bbox ) ;
17431734 }
17441735 buffer . push ( "Q" ) ;
17451736
@@ -1771,7 +1762,6 @@ class MarkupAnnotation extends Annotation {
17711762
17721763 const appearanceDict = new Dict ( xref ) ;
17731764 appearanceDict . set ( "Resources" , resources ) ;
1774- const bbox = ( this . data . rect = [ minX , minY , maxX , maxY ] ) ;
17751765 appearanceDict . set ( "BBox" , bbox ) ;
17761766
17771767 this . appearance = new StringStream ( "/GS0 gs /Fm0 Do" ) ;
@@ -4162,8 +4152,8 @@ class LineAnnotation extends MarkupAnnotation {
41624152 ) ;
41634153 return [
41644154 points [ 0 ] - borderWidth ,
4165- points [ 2 ] + borderWidth ,
41664155 points [ 7 ] - borderWidth ,
4156+ points [ 2 ] + borderWidth ,
41674157 points [ 3 ] + borderWidth ,
41684158 ] ;
41694159 } ,
@@ -4214,7 +4204,7 @@ class SquareAnnotation extends MarkupAnnotation {
42144204 } else {
42154205 buffer . push ( "S" ) ;
42164206 }
4217- return [ points [ 0 ] , points [ 2 ] , points [ 7 ] , points [ 3 ] ] ;
4207+ return [ points [ 0 ] , points [ 7 ] , points [ 2 ] , points [ 3 ] ] ;
42184208 } ,
42194209 } ) ;
42204210 }
@@ -4278,7 +4268,7 @@ class CircleAnnotation extends MarkupAnnotation {
42784268 } else {
42794269 buffer . push ( "S" ) ;
42804270 }
4281- return [ points [ 0 ] , points [ 2 ] , points [ 7 ] , points [ 3 ] ] ;
4271+ return [ points [ 0 ] , points [ 7 ] , points [ 2 ] , points [ 3 ] ] ;
42824272 } ,
42834273 } ) ;
42844274 }
@@ -4349,7 +4339,7 @@ class PolylineAnnotation extends MarkupAnnotation {
43494339 ) ;
43504340 }
43514341 buffer . push ( "S" ) ;
4352- return [ points [ 0 ] , points [ 2 ] , points [ 7 ] , points [ 3 ] ] ;
4342+ return [ points [ 0 ] , points [ 7 ] , points [ 2 ] , points [ 3 ] ] ;
43534343 } ,
43544344 } ) ;
43554345 }
@@ -4456,7 +4446,7 @@ class InkAnnotation extends MarkupAnnotation {
44564446 }
44574447 buffer . push ( "S" ) ;
44584448 }
4459- return [ points [ 0 ] , points [ 2 ] , points [ 7 ] , points [ 3 ] ] ;
4449+ return [ points [ 0 ] , points [ 7 ] , points [ 2 ] , points [ 3 ] ] ;
44604450 } ,
44614451 } ) ;
44624452 }
@@ -4688,7 +4678,7 @@ class HighlightAnnotation extends MarkupAnnotation {
46884678 `${ points [ 4 ] } ${ points [ 5 ] } l` ,
46894679 "f"
46904680 ) ;
4691- return [ points [ 0 ] , points [ 2 ] , points [ 7 ] , points [ 3 ] ] ;
4681+ return [ points [ 0 ] , points [ 7 ] , points [ 2 ] , points [ 3 ] ] ;
46924682 } ,
46934683 } ) ;
46944684 }
@@ -4813,7 +4803,7 @@ class UnderlineAnnotation extends MarkupAnnotation {
48134803 `${ points [ 6 ] } ${ points [ 7 ] + 1.3 } l` ,
48144804 "S"
48154805 ) ;
4816- return [ points [ 0 ] , points [ 2 ] , points [ 7 ] , points [ 3 ] ] ;
4806+ return [ points [ 0 ] , points [ 7 ] , points [ 2 ] , points [ 3 ] ] ;
48174807 } ,
48184808 } ) ;
48194809 }
@@ -4857,7 +4847,7 @@ class SquigglyAnnotation extends MarkupAnnotation {
48574847 buffer . push ( `${ x } ${ y + shift } l` ) ;
48584848 } while ( x < xEnd ) ;
48594849 buffer . push ( "S" ) ;
4860- return [ points [ 4 ] , xEnd , y - 2 * dy , y + 2 * dy ] ;
4850+ return [ points [ 4 ] , y - 2 * dy , xEnd , y + 2 * dy ] ;
48614851 } ,
48624852 } ) ;
48634853 }
@@ -4896,7 +4886,7 @@ class StrikeOutAnnotation extends MarkupAnnotation {
48964886 `${ ( points [ 3 ] + points [ 7 ] ) / 2 } l` ,
48974887 "S"
48984888 ) ;
4899- return [ points [ 0 ] , points [ 2 ] , points [ 7 ] , points [ 3 ] ] ;
4889+ return [ points [ 0 ] , points [ 7 ] , points [ 2 ] , points [ 3 ] ] ;
49004890 } ,
49014891 } ) ;
49024892 }
0 commit comments