@@ -420,40 +420,50 @@ function createWrapper(node, html) {
420
420
class : [ "xfaWrapper" ] ,
421
421
style : Object . create ( null ) ,
422
422
} ,
423
- children : [ html ] ,
423
+ children : [ ] ,
424
424
} ;
425
425
426
426
attributes . class . push ( "xfaWrapped" ) ;
427
427
428
428
if ( node . border ) {
429
429
const { widths, insets } = node . border [ $extra ] ;
430
- let shiftH = 0 ;
431
- let shiftW = 0 ;
430
+ let width , height ;
431
+ let top = insets [ 0 ] ;
432
+ let left = insets [ 3 ] ;
433
+ const insetsH = insets [ 0 ] + insets [ 2 ] ;
434
+ const insetsW = insets [ 1 ] + insets [ 3 ] ;
432
435
switch ( node . border . hand ) {
433
436
case "even" :
434
- shiftW = widths [ 0 ] / 2 ;
435
- shiftH = widths [ 3 ] / 2 ;
437
+ top -= widths [ 0 ] / 2 ;
438
+ left -= widths [ 3 ] / 2 ;
439
+ width = `calc(100% + ${ ( widths [ 1 ] + widths [ 3 ] ) / 2 - insetsW } px)` ;
440
+ height = `calc(100% + ${ ( widths [ 0 ] + widths [ 2 ] ) / 2 - insetsH } px)` ;
436
441
break ;
437
442
case "left" :
438
- shiftW = widths [ 0 ] ;
439
- shiftH = widths [ 3 ] ;
443
+ top -= widths [ 0 ] ;
444
+ left -= widths [ 3 ] ;
445
+ width = `calc(100% + ${ widths [ 1 ] + widths [ 3 ] - insetsW } px)` ;
446
+ height = `calc(100% + ${ widths [ 0 ] + widths [ 2 ] - insetsH } px)` ;
447
+ break ;
448
+ case "right" :
449
+ width = insetsW ? `calc(100% - ${ insetsW } px)` : "100%" ;
450
+ height = insetsH ? `calc(100% - ${ insetsH } px)` : "100%" ;
440
451
break ;
441
452
}
442
- const insetsW = insets [ 1 ] + insets [ 3 ] ;
443
- const insetsH = insets [ 0 ] + insets [ 2 ] ;
444
453
const classNames = [ "xfaBorder" ] ;
445
454
if ( isPrintOnly ( node . border ) ) {
446
455
classNames . push ( "xfaPrintOnly" ) ;
447
456
}
457
+
448
458
const border = {
449
459
name : "div" ,
450
460
attributes : {
451
461
class : classNames ,
452
462
style : {
453
- top : `${ insets [ 0 ] - widths [ 0 ] + shiftW } px` ,
454
- left : `${ insets [ 3 ] - widths [ 3 ] + shiftH } px` ,
455
- width : insetsW ? `calc(100% - ${ insetsW } px)` : "100%" ,
456
- height : insetsH ? `calc(100% - ${ insetsH } px)` : "100%" ,
463
+ top : `${ top } px` ,
464
+ left : `${ left } px` ,
465
+ width,
466
+ height,
457
467
} ,
458
468
} ,
459
469
children : [ ] ,
@@ -471,7 +481,9 @@ function createWrapper(node, html) {
471
481
delete style [ key ] ;
472
482
}
473
483
}
474
- wrapper . children . push ( border ) ;
484
+ wrapper . children . push ( border , html ) ;
485
+ } else {
486
+ wrapper . children . push ( html ) ;
475
487
}
476
488
477
489
for ( const key of [
0 commit comments