Compare commits

..

No commits in common. "e9b6624cb7a1258f6633b6418f0414b7b4d6f464" and "1ad47291f20ea4a2eda1c9ab186af7022d404071" have entirely different histories.

7 changed files with 19 additions and 173 deletions

View File

@ -8,7 +8,6 @@ import { currentObjectState } from '@/store/canvasAtom'
import { useAuxiliaryDrawing } from '@/hooks/roofcover/useAuxiliaryDrawing'
import { useSwal } from '@/hooks/useSwal'
import { normalizeDigits } from '@/util/input-utils'
import { CalculatorInput } from '@/components/common/input/CalcInput'
export default function AuxiliaryEdit(props) {
const contextPopupPosition = useRecoilValue(contextPopupPositionState)
@ -67,19 +66,7 @@ export default function AuxiliaryEdit(props) {
<p className="mb5">{getMessage('length')}</p>
<div className="input-move-wrap mb5">
<div className="input-move">
{/*<input type="text" className="input-origin" value={verticalSize} onChange={(e) => setVerticalSize(normalizeDigits(e.target.value))} />*/}
<CalculatorInput
id=""
name=""
label=""
className="input-origin block"
value={verticalSize}
onChange={(value) => setVerticalSize(value)}
options={{
allowNegative: false,
allowDecimal: false
}}
/>
<input type="text" className="input-origin" value={verticalSize} onChange={(e) => setVerticalSize(normalizeDigits(e.target.value))} />
</div>
<span>mm</span>
<div className="direction-move-wrap">
@ -101,19 +88,7 @@ export default function AuxiliaryEdit(props) {
</div>
<div className="input-move-wrap">
<div className="input-move">
{/*<input type="text" className="input-origin" value={horizonSize} onChange={(e) => setHorizonSize(normalizeDigits(e.target.value))} />*/}
<CalculatorInput
id=""
name=""
label=""
className="input-origin block"
value={horizonSize}
onChange={(value) => setHorizonSize(value)}
options={{
allowNegative: false,
allowDecimal: false
}}
/>
<input type="text" className="input-origin" value={horizonSize} onChange={(e) => setHorizonSize(normalizeDigits(e.target.value))} />
</div>
<span>mm</span>
<div className="direction-move-wrap">

View File

@ -8,21 +8,19 @@ import { useEffect, useState } from 'react'
import Big from 'big.js'
import { calcLineActualSize, calcLinePlaneSize } from '@/util/qpolygon-utils'
import { normalizeDigits } from '@/util/input-utils'
import { CalculatorInput } from '@/components/common/input/CalcInput'
export default function AuxiliarySize(props) {
const contextPopupPosition = useRecoilValue(contextPopupPositionState)
const { id, pos = contextPopupPosition } = props
const [checkedRadio, setCheckedRadio] = useState(null)
const [value1, setValue1] = useState('')
const [value2, setValue2] = useState('')
const [value1, setValue1] = useState(null)
const [value2, setValue2] = useState(null)
const [size, setSize] = useState(0)
const { getMessage } = useMessage()
const { closePopup } = usePopup()
const currentObject = useRecoilValue(currentObjectState)
const canvas = useRecoilValue(canvasState)
useEffect(() => {
return () => {
canvas?.discardActiveObject()
@ -39,7 +37,7 @@ export default function AuxiliarySize(props) {
}, [currentObject])
const handleInput = (e) => {
let value = e.replace(/^0+/, '')
let value = e.target.value.replace(/^0+/, '')
if (value === '') {
if (checkedRadio === 1) setValue1(value)
if (checkedRadio === 2) setValue2(value)
@ -132,20 +130,7 @@ export default function AuxiliarySize(props) {
<div className="outline-form">
<span style={{ width: 'auto' }}>{getMessage('length')}</span>
<div className="input-grid mr5">
{/*<input type="text" className="input-origin block" value={value1} readOnly={checkedRadio !== 1} onChange={handleInput} />*/}
<CalculatorInput
id=""
name=""
label=""
className="input-origin block"
value={value1}
onChange={handleInput}
readOnly={checkedRadio !== 1}
options={{
allowNegative: false,
allowDecimal: false
}}
/>
<input type="text" className="input-origin block" value={value1} readOnly={checkedRadio !== 1} onChange={handleInput} />
</div>
<span className="thin">mm</span>
</div>
@ -164,20 +149,7 @@ export default function AuxiliarySize(props) {
<div className="outline-form">
<span style={{ width: 'auto' }}>{getMessage('length')}</span>
<div className="input-grid mr5">
{/*<input type="text" className="input-origin block" value={value2} readOnly={checkedRadio !== 2} onChange={handleInput} />*/}
<CalculatorInput
id=""
name=""
label=""
className="input-origin block"
value={value2}
onChange={handleInput}
readOnly={checkedRadio !== 2}
options={{
allowNegative: false,
allowDecimal: false
}}
/>
<input type="text" className="input-origin block" value={value2} readOnly={checkedRadio !== 2} onChange={handleInput} />
</div>
<span className="thin">mm</span>
</div>

View File

@ -2,7 +2,6 @@ import { useMessage } from '@/hooks/useMessage'
import { useState } from 'react'
import { currentObjectState } from '@/store/canvasAtom'
import { useRecoilValue } from 'recoil'
import { CalculatorInput } from '@/components/common/input/CalcInput'
const FLOW_LINE_TYPE = {
DOWN_LEFT: 'downLeft',
@ -70,27 +69,13 @@ export default function FlowLine({ FLOW_LINE_REF }) {
<div className="outline-form">
<span>{getMessage('modal.movement.flow.line.movement')}</span>
<div className="input-grid mr5">
{/*<input*/}
{/* type="text"*/}
{/* className="input-origin block"*/}
{/* ref={FLOW_LINE_REF.FILLED_INPUT_REF}*/}
{/* value={filledInput}*/}
{/* onFocus={handleFocus}*/}
{/* onChange={handleInput}*/}
{/*/>*/}
<CalculatorInput
id=""
name=""
label=""
<input
type="text"
className="input-origin block"
ref={FLOW_LINE_REF.FILLED_INPUT_REF}
value={filledInput}
onFocus={handleFocus}
onChange={(value)=>{setFilledInput(value)}}
options={{
allowNegative: false,
allowDecimal: false
}}
onChange={handleInput}
/>
</div>
<span className="thin">mm</span>

View File

@ -3,7 +3,6 @@ import { useState } from 'react'
import { useRecoilValue } from 'recoil'
import { currentObjectState } from '@/store/canvasAtom'
import { normalizeDigits } from '@/util/input-utils'
import { CalculatorInput } from '@/components/common/input/CalcInput'
const UP_DOWN_TYPE = {
UP: 'up',
@ -36,7 +35,6 @@ export default function Updown({ UP_DOWN_REF }) {
<span>{getMessage('modal.movement.flow.line.position')}</span>
<div className="input-grid mr5">
<input type="text" className="input-origin block" defaultValue={100} readOnly={true} ref={UP_DOWN_REF.POINTER_INPUT_REF} />
</div>
</div>
<div className="moving-tab-content">
@ -70,27 +68,13 @@ export default function Updown({ UP_DOWN_REF }) {
<div className="outline-form">
<span>{getMessage('modal.movement.flow.line.movement')}</span>
<div className="input-grid mr5">
{/*<input*/}
{/* type="text"*/}
{/* className="input-origin block"*/}
{/* ref={UP_DOWN_REF.FILLED_INPUT_REF}*/}
{/* value={filledInput}*/}
{/* onFocus={handleFocus}*/}
{/* onChange={handleInput}*/}
{/*/>*/}
<CalculatorInput
id=""
name=""
label=""
<input
type="text"
className="input-origin block"
ref={UP_DOWN_REF.FILLED_INPUT_REF}
value={filledInput}
onFocus={handleFocus}
onChange={(value)=>{setFilledInput(value)}}
options={{
allowNegative: false,
allowDecimal: false
}}
onChange={handleInput}
/>
</div>
<span className="thin">mm</span>

View File

@ -1,7 +1,6 @@
import Image from 'next/image'
import { useMessage } from '@/hooks/useMessage'
import { forwardRef, useState } from 'react'
import { CalculatorInput } from '@/components/common/input/CalcInput'
const PlacementSurface = forwardRef((props, refs) => {
const { getMessage } = useMessage()
@ -75,32 +74,10 @@ const PlacementSurface = forwardRef((props, refs) => {
<div className="eaves-keraba-td">
<div className="outline-form">
<div className="input-grid mr5" style={{ width: '57px' }}>
{/*<input*/}
{/* type="text"*/}
{/* className="input-origin plane block"*/}
{/* defaultValue={line.value}*/}
{/* ref={*/}
{/* line.isDiagonal*/}
{/* ? lengthetc*/}
{/* : index === 0*/}
{/* ? length1*/}
{/* : index === 1*/}
{/* ? length2*/}
{/* : index === 2*/}
{/* ? length3*/}
{/* : index === 3*/}
{/* ? length4*/}
{/* : length5*/}
{/* }*/}
{/*/>*/}
<CalculatorInput
id=""
name=""
label=""
<input
type="text"
className="input-origin plane block"
value={line.value}
onChange={()=>{}}
defaultValue={line.value}
ref={
line.isDiagonal
? lengthetc
@ -114,10 +91,6 @@ const PlacementSurface = forwardRef((props, refs) => {
? length4
: length5
}
options={{
allowNegative: false,
allowDecimal: false
}}
/>
</div>
<span className="thin">mm</span>

View File

@ -1,7 +1,6 @@
import { useMessage } from '@/hooks/useMessage'
import { useEffect, useState } from 'react'
import { useEvent } from '@/hooks/useEvent'
import { CalculatorInput } from '@/components/common/input/CalcInput'
export default function Offset({ length1Ref, arrow1Ref, currentWallLineRef }) {
const { getMessage } = useMessage()
@ -75,20 +74,7 @@ export default function Offset({ length1Ref, arrow1Ref, currentWallLineRef }) {
<div className="eaves-keraba-td">
<div className="outline-form">
<div className="input-grid mr5" style={{ width: '100px' }}>
{/*<input type="text" className="input-origin block" placeholder={0} ref={length1Ref} />*/}
<CalculatorInput
id=""
name=""
label=""
className="input-origin block"
value={length1Ref.current?.value ?? 0}
ref={length1Ref}
onChange={() => {}}
options={{
allowNegative: false,
allowDecimal: false
}}
/>
<input type="text" className="input-origin block" placeholder={0} ref={length1Ref} />
</div>
<span className="thin">mm</span>
</div>

View File

@ -1,7 +1,6 @@
import { useMessage } from '@/hooks/useMessage'
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react'
import { useEvent } from '@/hooks/useEvent'
import { CalculatorInput } from '@/components/common/input/CalcInput'
export default forwardRef(function WallLine({ length1Ref, length2Ref, arrow1Ref, arrow2Ref, radioTypeRef, currentWallLineRef }, ref) {
const { getMessage } = useMessage()
@ -47,21 +46,7 @@ export default forwardRef(function WallLine({ length1Ref, length2Ref, arrow1Ref,
<div className="eaves-keraba-td">
<div className="outline-form">
<div className="input-grid mr5" style={{ width: '100px' }}>
{/*<input type="text" className="input-origin block" placeholder={0} readOnly={type !== 1} ref={length1Ref} />*/}
<CalculatorInput
id=""
name=""
label=""
className="input-origin block"
value={length1Ref.current?.value ?? 0}
ref={length1Ref}
onChange={() => {}}
readOnly={type !== 1}
options={{
allowNegative: false,
allowDecimal: false
}}
/>
<input type="text" className="input-origin block" placeholder={0} readOnly={type !== 1} ref={length1Ref} />
</div>
<span className="thin">mm</span>
</div>
@ -95,21 +80,7 @@ export default forwardRef(function WallLine({ length1Ref, length2Ref, arrow1Ref,
<div className="eaves-keraba-td">
<div className="outline-form">
<div className="input-grid mr5" style={{ width: '100px' }}>
{/*<input type="text" className="input-origin block" placeholder={0} readOnly={type !== 2} ref={length2Ref} />*/}
<CalculatorInput
id=""
name=""
label=""
className="input-origin block"
value={length2Ref.current?.value ?? 0}
ref={length2Ref}
onChange={() => {}}
readOnly={type !== 2}
options={{
allowNegative: false,
allowDecimal: false
}}
/>
<input type="text" className="input-origin block" placeholder={0} readOnly={type !== 2} ref={length2Ref} />
</div>
<span className="thin">mm</span>
</div>