Skip to content

Commit d577b2a

Browse files
committed
fix(components): 🐛 setting both showAngleLabel and showDistanceLabel to false, results in an error
closed #518
1 parent cdf15f2 commit d577b2a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/composables/use-drawing/use-drawing-polyline.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ export default function (props, ctx, cmpName: string) {
294294
if (defined(positionWindow)) {
295295
const l = (startPositionWindow.y - positionWindow.y) / (positionWindow.x - startPositionWindow.x)
296296
if (labels[i - 1] !== labelTotalLength) {
297-
labels[i - 1].horizontalOrigin = 0 < l ? HorizontalOrigin.LEFT : HorizontalOrigin.RIGHT
297+
if (defined(labels[i - 1]?.horizontalOrigin)) {
298+
labels[i - 1].horizontalOrigin = 0 < l ? HorizontalOrigin.LEFT : HorizontalOrigin.RIGHT
299+
}
298300
}
299301

300302
if (positionWindow.y < startY) {

packages/composables/use-drawing/use-drawing-segment.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,9 @@ export default function (props, ctx, cmpName: string) {
532532
const l = (startPositionWindow.y - positionWindow.y) / (positionWindow.x - startPositionWindow.x)
533533
const label = labels[i - 1]
534534
if (label && label !== labelTotalLength) {
535-
label.horizontalOrigin = 0 < l ? HorizontalOrigin.LEFT : HorizontalOrigin.RIGHT
535+
if (defined(label?.horizontalOrigin)) {
536+
label.horizontalOrigin = 0 < l ? HorizontalOrigin.LEFT : HorizontalOrigin.RIGHT
537+
}
536538
}
537539

538540
if (positionWindow.y < startY) {

0 commit comments

Comments
 (0)