Skip to content

Commit 2b6f8a7

Browse files
committed
Prevent zero division
1 parent 1ed5158 commit 2b6f8a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/gpad/TPadPainter.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,14 +1695,14 @@ class TPadPainter extends ObjectPainter {
16951695
r.ux1 = func(main.logx, r.ux1, 0);
16961696
r.ux2 = func(main.logx, r.ux2, 1);
16971697

1698-
let k = (r.ux2 - r.ux1)/frect.width;
1698+
let k = (r.ux2 - r.ux1)/(frect.width || 10);
16991699
r.px1 = r.ux1 - k*frect.x;
17001700
r.px2 = r.px1 + k*this.getPadWidth();
17011701

17021702
r.uy1 = func(main.logy, r.uy1, 0);
17031703
r.uy2 = func(main.logy, r.uy2, 1);
17041704

1705-
k = (r.uy2 - r.uy1)/frect.height;
1705+
k = (r.uy2 - r.uy1)/(frect.height || 10);
17061706
r.py1 = r.uy1 - k*frect.y;
17071707
r.py2 = r.py1 + k*this.getPadHeight();
17081708

0 commit comments

Comments
 (0)