From 8f28f5783e1f79d15b370c2b16b1f4e36c097d39 Mon Sep 17 00:00:00 2001 From: senorbeast Date: Sun, 6 Mar 2022 00:33:26 +0530 Subject: [PATCH] fix: :fire: Slider set to last move after editing scramble. Not necessary but Aditya Needs it. --- src/components/CubeD/UX/Scramble.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/CubeD/UX/Scramble.tsx b/src/components/CubeD/UX/Scramble.tsx index 74e69b3..ccdf36d 100644 --- a/src/components/CubeD/UX/Scramble.tsx +++ b/src/components/CubeD/UX/Scramble.tsx @@ -2,8 +2,9 @@ import { Typography } from '@material-ui/core'; import { useEffect } from 'react'; import { ScrambleI, InTextArea1 } from './CubeElements'; import selMode from './modes'; -import { useScra, useSetScra, useSol } from '../AlgProvider'; - +import { useScra, useSetScra, useSol, useSetMoveNum } from '../AlgProvider'; +import getAlgs from '../Parser/getAlgs'; +import validateAlgs from '../Parser/validateAlg'; interface propsM { mode: string; } @@ -12,6 +13,8 @@ const Scramble = ({ mode }: propsM) => { let newScra = useScra(); let newSol = useSol(); let setScra = useSetScra(); + let setCMovNum = useSetMoveNum(); + useEffect(() => { if (newScra != undefined) { console.log('URL useEffect'); @@ -45,6 +48,7 @@ const Scramble = ({ mode }: propsM) => { var Scra = event.target.value; //setnewScra(Scra); setScra(Scra); + setCMovNum(validateAlgs(getAlgs(newSol)).movesNum); //handleScra(Scra); } };