big.mjs:139 Uncaught Error: [big.js] Invalid number
at klass.setLength (QLine.js:72:36) (NaN => 0 처리)
This commit is contained in:
parent
68680e0042
commit
8a61f90971
@ -2,6 +2,7 @@ import { fabric } from 'fabric'
|
|||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { getDirectionByPoint } from '@/util/canvas-util'
|
import { getDirectionByPoint } from '@/util/canvas-util'
|
||||||
import { calcLinePlaneSize } from '@/util/qpolygon-utils'
|
import { calcLinePlaneSize } from '@/util/qpolygon-utils'
|
||||||
|
import { logger } from '@/util/logger'
|
||||||
|
|
||||||
export const QLine = fabric.util.createClass(fabric.Line, {
|
export const QLine = fabric.util.createClass(fabric.Line, {
|
||||||
type: 'QLine',
|
type: 'QLine',
|
||||||
@ -69,7 +70,14 @@ export const QLine = fabric.util.createClass(fabric.Line, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setLength() {
|
setLength() {
|
||||||
this.length = calcLinePlaneSize(this) / 10
|
// Ensure all required properties are valid numbers
|
||||||
|
const { x1, y1, x2, y2 } = this;
|
||||||
|
if (isNaN(x1) || isNaN(y1) || isNaN(x2) || isNaN(y2)) {
|
||||||
|
logger.error('Invalid coordinates in QLine:', { x1, y1, x2, y2 });
|
||||||
|
this.length = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.length = calcLinePlaneSize({ x1, y1, x2, y2 }) / 10;
|
||||||
},
|
},
|
||||||
|
|
||||||
addLengthText() {
|
addLengthText() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user