[1267] 500에러 - str => Number 변환

This commit is contained in:
ysCha 2025-08-20 17:00:17 +09:00
parent d98eba97a7
commit 5cf5ef55af
3 changed files with 15 additions and 7 deletions

View File

@ -17,7 +17,7 @@ export const QLine = fabric.util.createClass(fabric.Line, {
initialize: function (points, options, length = 0) {
// 소수점 전부 제거
points = points.map((point) => Number(point?.toFixed(1)))
points = points.map((point) => Number(point).toFixed(1))
this.callSuper('initialize', points, { ...options, selectable: options.selectable ?? true })
if (options.id) {

View File

@ -710,14 +710,14 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, {
inPolygonImproved(point) {
const vertices = this.points
let inside = false
const testX = Number(point.x.toFixed(this.toFixed))
const testY = Number(point.y.toFixed(this.toFixed))
const testX = Number(point.x).toFixed(this.toFixed)
const testY = Number(point.y).toFixed(this.toFixed)
for (let i = 0, j = vertices.length - 1; i < vertices.length; j = i++) {
const xi = Number(vertices[i].x.toFixed(this.toFixed))
const yi = Number(vertices[i].y.toFixed(this.toFixed))
const xj = Number(vertices[j].x.toFixed(this.toFixed))
const yj = Number(vertices[j].y.toFixed(this.toFixed))
const xi = Number(vertices[i].x).toFixed(this.toFixed)
const yi = Number(vertices[i].y).toFixed(this.toFixed)
const xj = Number(vertices[j].x).toFixed(this.toFixed)
const yj = Number(vertices[j].y).toFixed(this.toFixed)
// 점이 정점 위에 있는지 확인
if (Math.abs(xi - testX) < 0.01 && Math.abs(yi - testY) < 0.01) {

View File

@ -342,6 +342,14 @@ export const findIntersection1 = (line1, line2) => {
}
export const calculateIntersection = (line1, line2) => {
line1.x1 = Number(line1.x1)
line1.y1 = Number(line1.y1)
line1.x2 = Number(line1.x2)
line1.y2 = Number(line1.y2)
line2.x1 = Number(line2.x1)
line2.y1 = Number(line2.y1)
line2.x2 = Number(line2.x2)
line2.y2 = Number(line2.y2)
const result = intersect([line1.x1, line1.y1], [line1.x2, line1.y2], [line2.x1, line2.y1], [line2.x2, line2.y2])
if (!result) {
return null