Compare commits

..

No commits in common. "043c369c0e23ccb75b021bc628b95bfd9a7abf5e" and "68680e004267f1a3a5fc04b9b0dc22c3f3ad7312" have entirely different histories.

3 changed files with 5 additions and 14 deletions

View File

@ -2,7 +2,6 @@ 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',
@ -70,14 +69,7 @@ export const QLine = fabric.util.createClass(fabric.Line, {
}, },
setLength() { setLength() {
// Ensure all required properties are valid numbers this.length = calcLinePlaneSize(this) / 10
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() {

View File

@ -169,7 +169,6 @@ const Placement = forwardRef((props, refs) => {
<div className="roof-module-table"> <div className="roof-module-table">
<table> <table>
<thead> <thead>
<tr>
{moduleData.header.map((data) => ( {moduleData.header.map((data) => (
<th key={data.prop} style={{ width: data.width ? data.width : '' }}> <th key={data.prop} style={{ width: data.width ? data.width : '' }}>
{data.type === 'check' ? ( {data.type === 'check' ? (
@ -182,7 +181,6 @@ const Placement = forwardRef((props, refs) => {
)} )}
</th> </th>
))} ))}
</tr>
</thead> </thead>
<tbody> <tbody>
{selectedModules?.itemList && {selectedModules?.itemList &&
@ -218,7 +216,7 @@ const Placement = forwardRef((props, refs) => {
className="input-origin block" className="input-origin block"
name="row" name="row"
value={props.layoutSetup[index]?.row ?? 1} value={props.layoutSetup[index]?.row ?? 1}
//defaultValue={0} defaultValue={0}
onChange={(e) => handleLayoutSetup(e, item.itemId, index)} onChange={(e) => handleLayoutSetup(e, item.itemId, index)}
/> />
</div> </div>
@ -230,7 +228,7 @@ const Placement = forwardRef((props, refs) => {
className="input-origin block" className="input-origin block"
name="col" name="col"
value={props.layoutSetup[index]?.col ?? 1} value={props.layoutSetup[index]?.col ?? 1}
//defaultValue={0} defaultValue={0}
onChange={(e) => handleLayoutSetup(e, item.itemId, index)} onChange={(e) => handleLayoutSetup(e, item.itemId, index)}
/> />
</div> </div>

View File

@ -86,7 +86,7 @@ export default function RoofAllocationSetting(props) {
return ( return (
<div className="grid-option-box" key={index}> <div className="grid-option-box" key={index}>
<div className="d-check-radio pop no-text"> <div className="d-check-radio pop no-text">
<input type="radio" name="radio01" checked={roof.selected} readOnly /> <input type="radio" name="radio01" checked={roof.selected && 'checked'} readOnly={true} />
<label <label
htmlFor="ra01" htmlFor="ra01"
onClick={(e) => { onClick={(e) => {
@ -213,6 +213,7 @@ export default function RoofAllocationSetting(props) {
handleChangePitch(e, index) handleChangePitch(e, index)
}} }}
value={currentAngleType === 'slope' ? roof.pitch : roof.angle} value={currentAngleType === 'slope' ? roof.pitch : roof.angle}
defaultValue={currentAngleType === 'slope' ? roof.pitch : roof.angle}
/> />
</div> </div>
<span className="absol">{pitchText}</span> <span className="absol">{pitchText}</span>