From a8152c92b9b84f0dcc0d8d03ccdb272834376d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sanguu516=28=EB=B0=95=EC=83=81=ED=98=84=29?= Date: Mon, 4 Sep 2023 15:35:33 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=84=ED=96=89=20=EB=B9=84=EB=AC=BC?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=85=98=20=EC=88=AB=EC=9E=90=20->=20hh:mm?= =?UTF-8?q?=20=ED=98=95=EC=8B=9D=20=EB=B3=80=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/AnalysisSimulatorSlider.js | 29 +++++++++++++++++-- src/components/map/MapControl.js | 4 +-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/components/analysis/simulation/AnalysisSimulatorSlider.js b/src/components/analysis/simulation/AnalysisSimulatorSlider.js index c5bb4219..f7f8ef3a 100644 --- a/src/components/analysis/simulation/AnalysisSimulatorSlider.js +++ b/src/components/analysis/simulation/AnalysisSimulatorSlider.js @@ -7,6 +7,22 @@ const AnalysisSimulatorSlider = ({ playCount, setSliderCount }) => { + // hh:mm 형식으로 바꿔주는 코드 + function convertToTimeFormat(number) { + // 시간과 분 계산 + const hours = Math.floor(number / 60); + const minutes = Math.floor(number % 60); + + // 2자리 숫자로 포맷팅 + const formattedHours = String(hours).padStart(2, '0'); + const formattedMinutes = String(minutes).padStart(2, '0'); + + // 시간 문자열 생성 + const timeString = `${formattedHours}:${formattedMinutes}`; + + return timeString; + } + const colorOptions = { start: [playCount ? playCount : 0], // connect: true, @@ -20,9 +36,10 @@ const AnalysisSimulatorSlider = ({ format: { // 'to' the formatted value. Receives a number. to: function (value) { - return Math.round(value); + return convertToTimeFormat(value); }, - // 'from' the formatted value. + + // // 'from' the formatted value. // Receives a string, should return a number. from: function (value) { return Math.round(value); @@ -34,7 +51,13 @@ const AnalysisSimulatorSlider = ({ density: 3 }, onChange: e => { - setSliderCount(e); + function timeStringToMinutes(timeString) { + const [hours, minutes] = timeString.split(':').map(Number); + const totalMinutes = hours * 60 + minutes; + return totalMinutes.toString(); + } + + setSliderCount(e.map(timeStringToMinutes)); }, direction }; diff --git a/src/components/map/MapControl.js b/src/components/map/MapControl.js index e550c41e..993c7138 100644 --- a/src/components/map/MapControl.js +++ b/src/components/map/MapControl.js @@ -5,8 +5,8 @@ import MapBoxMap from './mapbox/MapBoxMap'; export const MapControl = props => { return ( - <>{props.mapType === 'google' ? : } + // <>{props.mapType === 'google' ? : } // - // + ); };