@@ -110,10 +110,24 @@ describe("objectBoundsDots", () => {
110110 expect ( objectBoundsDots ( t , ctx ( measured ) ) ) . toEqual ( { x : 12 , y : 24 , width : 77 , height : 30 } ) ;
111111 } ) ;
112112
113- it ( "single-line text: measured footprint is used verbatim (producer already rotated it) " , ( ) => {
113+ it ( "single-line text: rotated footprint size is verbatim, top-left shifts for R " , ( ) => {
114114 const t = leaf ( "text" , 12 , 24 , { content : "Hello" , fontHeight : 30 , fontWidth : 0 , rotation : "R" } ) ;
115115 const measured = new Map ( [ [ t . id , { width : 30 , height : 77 } ] ] ) ; // already rotated
116- expect ( objectBoundsDots ( t , ctx ( measured ) ) ) . toEqual ( { x : 12 , y : 24 , width : 30 , height : 77 } ) ;
116+ // Size used verbatim (not re-rotated); R rotates about the anchor, so the
117+ // visual top-left moves left by the rotated width (mirrors blockBoundsDots).
118+ expect ( objectBoundsDots ( t , ctx ( measured ) ) ) . toEqual ( { x : - 18 , y : 24 , width : 30 , height : 77 } ) ;
119+ } ) ;
120+
121+ it ( "single-line text: B rotates about the anchor, top-left moves up" , ( ) => {
122+ const t = leaf ( "text" , 12 , 24 , { content : "Hello" , fontHeight : 30 , fontWidth : 0 , rotation : "B" } ) ;
123+ const measured = new Map ( [ [ t . id , { width : 30 , height : 77 } ] ] ) ; // already rotated
124+ expect ( objectBoundsDots ( t , ctx ( measured ) ) ) . toEqual ( { x : 12 , y : - 53 , width : 30 , height : 77 } ) ;
125+ } ) ;
126+
127+ it ( "single-line text: I rotates about the anchor, top-left moves left and up" , ( ) => {
128+ const t = leaf ( "text" , 12 , 24 , { content : "Hello" , fontHeight : 30 , fontWidth : 0 , rotation : "I" } ) ;
129+ const measured = new Map ( [ [ t . id , { width : 77 , height : 30 } ] ] ) ; // already rotated
130+ expect ( objectBoundsDots ( t , ctx ( measured ) ) ) . toEqual ( { x : - 65 , y : - 6 , width : 77 , height : 30 } ) ;
117131 } ) ;
118132
119133 it ( "single-line text: fallback estimate swaps axes for R" , ( ) => {
0 commit comments