Browse Source

确保表单数字输入项最终被以数字类型使用。

任一存 1 year ago
parent
commit
4fc82d73a6
2 changed files with 9 additions and 9 deletions
  1. 5 5
      src/App.vue
  2. 4 4
      src/components/PointEditor.vue

+ 5 - 5
src/App.vue

@@ -733,9 +733,9 @@ export default {
     },
     onSetHeightFilter() {
       gNode.selectAll('rect').attr('visibility', (d) => {
-        if ((this.formData.maxHeight !== '') && (this.formData.maxHeight < d[2])) {
+        if ((this.formData.maxHeight !== '') && (Number(this.formData.maxHeight) < d[2])) {
           return 'hidden'
-        } else if ((this.formData.minHeight !== '') && (this.formData.minHeight > d[2])) {
+        } else if ((this.formData.minHeight !== '') && (Number(this.formData.minHeight) > d[2])) {
           return 'hidden'
         } else {
           return 'visible'
@@ -814,7 +814,7 @@ export default {
       const affectedPointList = []
       for (const point of rawWholeData) {
         // 如果z不合格,pass
-        if (Math.abs(point.z - this.formData.addPointHeight) > this.formData.connectionMaxHeightGap) {
+        if (Math.abs(point.z - Number(this.formData.addPointHeight)) > Number(this.formData.connectionMaxHeightGap)) {
           continue
         }
         // 如果在affection范围外,pass
@@ -836,7 +836,7 @@ export default {
       const pointInBrushList = []
       for (const point of rawWholeData) {
         // 如果z不合格,pass
-        if (Math.abs(point.z - this.formData.addPointHeight) > this.formData.connectionMaxHeightGap) {
+        if (Math.abs(point.z - Number(this.formData.addPointHeight)) > Number(this.formData.connectionMaxHeightGap)) {
           continue
         }
         // 如果在框选区域内,留下
@@ -963,7 +963,7 @@ export default {
                   id: newPointId,
                   x: neiPos.x,
                   y: neiPos.y,
-                  z: this.formData.addPointHeight,
+                  z: Number(this.formData.addPointHeight),
                   datasetId: pointDatasetId,
                   weight: pointWeight,
                 })

+ 4 - 4
src/components/PointEditor.vue

@@ -107,10 +107,10 @@ export default {
     onClickConfirm() {
       this.$emit('confirm', {
         id: this.initialPointData.id,
-        x: this.x,
-        y: this.y,
-        z: this.z,
-        weight: this.weight,
+        x: Number(this.x),
+        y: Number(this.y),
+        z: Number(this.z),
+        weight: Number(this.weight),
         ids: this.ids.split(',')
       })
     }