@@ -107,13 +107,14 @@ CommonMtrMixin<SVGmtd<any, any, any>, SVGConstructor<any, any, any>>(SVGWrapper)
107
107
const cSpace = this . parent . getColumnHalfSpacing ( ) ;
108
108
const cLines = [ this . parent . fLine , ...this . parent . cLines , this . parent . fLine ] ;
109
109
const cWidth = this . parent . getComputedWidths ( ) ;
110
+ const scale = 1 / this . getBBox ( ) . rscale ;
110
111
let x = cLines [ 0 ] ;
111
112
for ( let i = 0 ; i < this . numCells ; i ++ ) {
112
113
const child = this . getChild ( i ) ;
113
114
child . toSVG ( svg ) ;
114
115
x += this . placeCell ( child , {
115
- x : x , y : 0 , lSpace : cSpace [ i ] , rSpace : cSpace [ i + 1 ] , w : cWidth [ i ] ,
116
- lLine : cLines [ i ] , rLine : cLines [ i + 1 ]
116
+ x : x , y : 0 , lSpace : cSpace [ i ] * scale , rSpace : cSpace [ i + 1 ] * scale , w : cWidth [ i ] * scale ,
117
+ lLine : cLines [ i ] * scale , rLine : cLines [ i + 1 ] * scale
117
118
} ) ;
118
119
}
119
120
}
@@ -125,26 +126,28 @@ CommonMtrMixin<SVGmtd<any, any, any>, SVGConstructor<any, any, any>>(SVGWrapper)
125
126
*/
126
127
public placeCell ( cell : SVGmtd < N , T , D > , sizes : SizeData ) : number {
127
128
const { x, y, lSpace, w, rSpace, lLine, rLine} = sizes ;
128
- const [ dx , dy ] = cell . placeCell ( x + lSpace , y , w , this . H , this . D ) ;
129
+ const scale = 1 / this . getBBox ( ) . rscale ;
130
+ const [ h , d ] = [ this . H * scale , this . D * scale ] ;
131
+ const [ t , b ] = [ this . tSpace * scale , this . bSpace * scale ] ;
132
+ const [ dx , dy ] = cell . placeCell ( x + lSpace , y , w , h , d ) ;
129
133
const W = lSpace + w + rSpace ;
130
- const [ H , D ] = [ this . H + this . tSpace , this . D + this . bSpace ] ;
131
- cell . placeColor ( - ( dx + lSpace + lLine / 2 ) , - ( D + this . bLine / 2 + dy ) ,
132
- W + ( lLine + rLine ) / 2 , H + D + ( this . tLine + this . bLine ) / 2 ) ;
134
+ cell . placeColor ( - ( dx + lSpace + lLine / 2 ) , - ( d + b + dy ) , W + ( lLine + rLine ) / 2 , h + d + t + b ) ;
133
135
return W + rLine ;
134
136
}
135
137
136
138
/**
137
139
* Expand the backgound color to fill the entire row
138
140
*/
139
141
protected placeColor ( ) {
142
+ const scale = 1 / this . getBBox ( ) . rscale ;
140
143
const adaptor = this . adaptor ;
141
144
const child = adaptor . firstChild ( this . element ) ;
142
145
if ( child && adaptor . kind ( child ) === 'rect' && adaptor . getAttribute ( child , 'data-bgcolor' ) ) {
143
- const [ TL , BL ] = [ this . tLine / 2 , this . bLine / 2 ] ;
144
- const [ TS , BS ] = [ this . tSpace , this . bSpace ] ;
145
- const [ H , D ] = [ this . H , this . D ] ;
146
+ const [ TL , BL ] = [ ( this . tLine / 2 ) * scale , ( this . bLine / 2 ) * scale ] ;
147
+ const [ TS , BS ] = [ this . tSpace * scale , this . bSpace * scale ] ;
148
+ const [ H , D ] = [ this . H * scale , this . D * scale ] ;
146
149
adaptor . setAttribute ( child , 'y' , this . fixed ( - ( D + BS + BL ) ) ) ;
147
- adaptor . setAttribute ( child , 'width' , this . fixed ( this . parent . getWidth ( ) ) ) ;
150
+ adaptor . setAttribute ( child , 'width' , this . fixed ( this . parent . getWidth ( ) * scale ) ) ;
148
151
adaptor . setAttribute ( child , 'height' , this . fixed ( TL + TS + H + D + BS + BL ) ) ;
149
152
}
150
153
}
0 commit comments