Skip to content

Commit 4a3a7ae

Browse files
committed
small cleanup, disable slope variable for non-lines
1 parent 8eb9cf7 commit 4a3a7ae

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/components/shapes/label_texttemplate.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,11 @@ function dyFn(shape, xa, ya) {
3434
}
3535

3636
function widthFn(shape, xa) {
37-
return Math.abs(
38-
d2l(shape.x1, xa) -
39-
d2l(shape.x0, xa)
40-
);
37+
return Math.abs(dxFn(shape, xa));
4138
}
4239

4340
function heightFn(shape, xa, ya) {
44-
return Math.abs(
45-
d2l(shape.y1, ya) -
46-
d2l(shape.y0, ya)
47-
);
41+
return Math.abs(dyFn(shape, xa, ya));
4842
}
4943

5044
function lengthFn(shape, xa, ya) {
@@ -66,7 +60,7 @@ function ycenterFn(shape, xa, ya) {
6660
}
6761

6862
function slopeFn(shape, xa, ya) {
69-
return (
63+
return (shape.type !== 'line') ? undefined : (
7064
(d2l(shape.y1, ya) - d2l(shape.y0, ya)) /
7165
(d2l(shape.x1, xa) - d2l(shape.x0, xa))
7266
);

0 commit comments

Comments
 (0)