Browse Source

Laanc 고도 반경 input 포커스 기능 추가

pull/2/head
sanguu516(박상현) 12 months ago
parent
commit
8c26c9c6e1
  1. 3
      src/containers/laanc/LaancPlanContainer.js
  2. 40
      src/views/laanc/LaancStep1.js

3
src/containers/laanc/LaancPlanContainer.js

@ -88,7 +88,8 @@ export default function LaancPlanContainer({
case 'pilot': case 'pilot':
case 'arcrft': case 'arcrft':
if (name === 'fltElev' || name === 'bufferZone' || name === 'hpno') { if (name === 'fltElev' || name === 'bufferZone' || name === 'hpno') {
const newValue = value.replace(/[^0-9]/g, ''); const newValue = value.replace(/^0+/, '').replace(/\D/g, '');
setDetailData(prevState => { setDetailData(prevState => {
const arr = [...prevState[arrName]]; const arr = [...prevState[arrName]];
const updateData = { const updateData = {

40
src/views/laanc/LaancStep1.js

@ -58,23 +58,23 @@ export default function LaancStep1({
if (!currentParm) setCenteredModal(mapParam); if (!currentParm) setCenteredModal(mapParam);
}, [location]); }, [location]);
// const handleInputClick = () => { const handleInputClick = type => {
// // Input 요소가 포커스될 때 커서를 맨 뒤로 이동 // Input 요소가 포커스될 때 커서를 맨 뒤로 이동
// if (fltElevRef.current) { if (fltElevRef.current && type === 'fltElev') {
// const input = fltElevRef.current; const input = fltElevRef.current;
// const inputValue = input.value; const inputValue = input.value;
// input.setSelectionRange(inputValue.length - 1, inputValue.length - 1); input.setSelectionRange(inputValue.length - 1, inputValue.length - 1);
// input.focus(); input.focus();
// } }
// if (bufferZoneRef.current) { if (bufferZoneRef.current && type === 'bufferZone') {
// const input = bufferZoneRef.current; const input = bufferZoneRef.current;
// const inputValue = input.value; const inputValue = input.value;
// input.setSelectionRange(inputValue.length - 1, inputValue.length - 1); input.setSelectionRange(inputValue.length - 1, inputValue.length - 1);
// input.focus(); input.focus();
// } }
// }; };
return ( return (
<> <>
@ -262,9 +262,8 @@ export default function LaancStep1({
value value
}); });
}} }}
// innerRef={fltElevRef} // Input 요소에 ref를 연결 innerRef={fltElevRef} // Input 요소에 ref를 연결
// onClick={handleInputClick} onClick={() => handleInputClick('fltElev')}
// innerRef={data}
placeholder='100m' placeholder='100m'
/> />
</FormGroup> </FormGroup>
@ -289,9 +288,8 @@ export default function LaancStep1({
value value
}); });
}} }}
// innerRef={bufferZoneRef} // Input 요소에 ref를 연결 innerRef={bufferZoneRef} // Input 요소에 ref를 연결
// onClick={handleInputClick} onClick={() => handleInputClick('bufferZone')}
// innerRef={data}
placeholder='100m' placeholder='100m'
/> />
</FormGroup> </FormGroup>

Loading…
Cancel
Save