Skip to content

Commit

Permalink
fix(components): 🐛 setting both showAngleLabel and showDistanceLabel …
Browse files Browse the repository at this point in the history
…to false, results in an error

closed #518
  • Loading branch information
zouyaoji committed Feb 28, 2024
1 parent cdf15f2 commit d577b2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/composables/use-drawing/use-drawing-polyline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ export default function (props, ctx, cmpName: string) {
if (defined(positionWindow)) {
const l = (startPositionWindow.y - positionWindow.y) / (positionWindow.x - startPositionWindow.x)
if (labels[i - 1] !== labelTotalLength) {
labels[i - 1].horizontalOrigin = 0 < l ? HorizontalOrigin.LEFT : HorizontalOrigin.RIGHT
if (defined(labels[i - 1]?.horizontalOrigin)) {
labels[i - 1].horizontalOrigin = 0 < l ? HorizontalOrigin.LEFT : HorizontalOrigin.RIGHT
}
}

if (positionWindow.y < startY) {
Expand Down
4 changes: 3 additions & 1 deletion packages/composables/use-drawing/use-drawing-segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,9 @@ export default function (props, ctx, cmpName: string) {
const l = (startPositionWindow.y - positionWindow.y) / (positionWindow.x - startPositionWindow.x)
const label = labels[i - 1]
if (label && label !== labelTotalLength) {
label.horizontalOrigin = 0 < l ? HorizontalOrigin.LEFT : HorizontalOrigin.RIGHT
if (defined(label?.horizontalOrigin)) {
label.horizontalOrigin = 0 < l ? HorizontalOrigin.LEFT : HorizontalOrigin.RIGHT
}
}

if (positionWindow.y < startY) {
Expand Down

0 comments on commit d577b2a

Please sign in to comment.