dev #319
@ -2,6 +2,7 @@ import { fabric } from 'fabric'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { getDirectionByPoint } from '@/util/canvas-util'
|
||||
import { calcLinePlaneSize } from '@/util/qpolygon-utils'
|
||||
import { logger } from '@/util/logger'
|
||||
|
||||
export const QLine = fabric.util.createClass(fabric.Line, {
|
||||
type: 'QLine',
|
||||
@ -69,7 +70,14 @@ export const QLine = fabric.util.createClass(fabric.Line, {
|
||||
},
|
||||
|
||||
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() {
|
||||
|
||||
@ -169,6 +169,7 @@ const Placement = forwardRef((props, refs) => {
|
||||
<div className="roof-module-table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
{moduleData.header.map((data) => (
|
||||
<th key={data.prop} style={{ width: data.width ? data.width : '' }}>
|
||||
{data.type === 'check' ? (
|
||||
@ -181,6 +182,7 @@ const Placement = forwardRef((props, refs) => {
|
||||
)}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{selectedModules?.itemList &&
|
||||
@ -216,7 +218,7 @@ const Placement = forwardRef((props, refs) => {
|
||||
className="input-origin block"
|
||||
name="row"
|
||||
value={props.layoutSetup[index]?.row ?? 1}
|
||||
defaultValue={0}
|
||||
//defaultValue={0}
|
||||
onChange={(e) => handleLayoutSetup(e, item.itemId, index)}
|
||||
/>
|
||||
</div>
|
||||
@ -228,7 +230,7 @@ const Placement = forwardRef((props, refs) => {
|
||||
className="input-origin block"
|
||||
name="col"
|
||||
value={props.layoutSetup[index]?.col ?? 1}
|
||||
defaultValue={0}
|
||||
//defaultValue={0}
|
||||
onChange={(e) => handleLayoutSetup(e, item.itemId, index)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -86,7 +86,7 @@ export default function RoofAllocationSetting(props) {
|
||||
return (
|
||||
<div className="grid-option-box" key={index}>
|
||||
<div className="d-check-radio pop no-text">
|
||||
<input type="radio" name="radio01" checked={roof.selected && 'checked'} readOnly={true} />
|
||||
<input type="radio" name="radio01" checked={roof.selected} readOnly />
|
||||
<label
|
||||
htmlFor="ra01"
|
||||
onClick={(e) => {
|
||||
@ -213,7 +213,6 @@ export default function RoofAllocationSetting(props) {
|
||||
handleChangePitch(e, index)
|
||||
}}
|
||||
value={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
||||
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
|
||||
/>
|
||||
</div>
|
||||
<span className="absol">{pitchText}</span>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user