Skip to content

Commit 5979969

Browse files
committed
Updates requeste by Volker's review
1 parent 1a1caef commit 5979969

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

ts/output/common/Wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export class CommonWrapper<
328328
for (const [name, side] of BBox.StyleAdjust) {
329329
const x = this.styles.get(name);
330330
if (x) {
331-
(obox as any)[side] += this.length2em(this.styles.get(name), 1, obox.rscale);
331+
(obox as any)[side] += this.length2em(x, 1, obox.rscale);
332332
}
333333
}
334334
return obox;

ts/output/svg/Wrapper.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,19 @@ CommonWrapper<
250250
const f = SVGWrapper.borderFuzz;
251251
const bbox = this.getOuterBBox();
252252
const [h, d, w] = [bbox.h + f, bbox.d + f, bbox.w + f];
253-
const paths: [number, number][][] = [
254-
[[-f, h], [w, h], [w - width[1], h - width[0]], [-f + width[3], h - width[0]]],
255-
[[w, -d], [w, h], [w - width[1], h - width[0]], [w - width[1], -d + width[2]]],
256-
[[-f, -d], [w, -d], [w - width[1], -d + width[2]], [-f + width[3], -d + width[2]]],
257-
[[-f, -d], [-f, h], [-f + width[3], h - width[0]], [-f + width[3], -d + width[2]]]
253+
const outerRT = [w, h];
254+
const outerLT = [-f, h];
255+
const outerRB = [w, -d];
256+
const outerLB = [-f, -d];
257+
const innerRT = [w - width[1], h - width[0]];
258+
const innerLT = [-f + width[3], h - width[0]];
259+
const innerRB = [w - width[1], -d + width[2]];
260+
const innerLB = [-f + width[3],-d + width[2]];
261+
const paths: number[][][] = [
262+
[outerLT, outerRT, innerRT, innerLT],
263+
[outerRB, outerRT, innerRT, innerRB],
264+
[outerLB, outerRB, innerRB, innerLB],
265+
[outerLB, outerLT, innerLT, innerLB]
258266
];
259267
const adaptor = this.adaptor;
260268
const child = adaptor.firstChild(this.element) as N;
@@ -276,7 +284,7 @@ CommonWrapper<
276284
* @param {string} color The color to use
277285
* @param {N} child Insert the border before this child, if any
278286
*/
279-
protected addBorderSolid(path: [number, number][], color: string, child: N) {
287+
protected addBorderSolid(path: number[][], color: string, child: N) {
280288
const border = this.svg('polygon', {
281289
points: path.map(([x, y]) => `${this.fixed(x - this.dx)},${this.fixed(y)}`).join(' '),
282290
stroke: 'none',
@@ -298,7 +306,7 @@ CommonWrapper<
298306
* @param {number} t The thickness for the border line
299307
* @param {number} i The side being drawn
300308
*/
301-
protected addBorderBroken(path: [number, number][], color: string, style: string, t: number, i: number) {
309+
protected addBorderBroken(path: number[][], color: string, style: string, t: number, i: number) {
302310
const dot = (style === 'dotted');
303311
const t2 = t / 2;
304312
const [tx1, ty1, tx2, ty2] = [[t2, -t2, -t2, -t2], [-t2, t2, -t2, -t2], [t2, t2, -t2, t2], [t2, t2, t2, -t2]][i];

0 commit comments

Comments
 (0)