Skip to content

Commit

Permalink
example "glitch prevention"
Browse files Browse the repository at this point in the history
  • Loading branch information
bacalj committed Aug 16, 2024
1 parent 11e2bdb commit 5923296
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/grasp-seasons/components/seasons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const Seasons: React.FC<IProps> = ({ lang = "en_us", initialState = {}, log = (a
const handleLatSliderChange = (event: any, ui: any) => {
setSimState(prevState => ({ ...prevState, lat: ui.value }));
setLatitude(formatLatLongNumber(ui.value));
setLocationSearch("");
// setLocationSearch("");
};

const handleLatInputChange = (event: ChangeEvent<HTMLInputElement>) => {
Expand All @@ -211,14 +211,17 @@ const Seasons: React.FC<IProps> = ({ lang = "en_us", initialState = {}, log = (a

const handleLatIncrement = (increment: number) => () => {
setSimState(prevState => ({ ...prevState, lat: prevState.lat + increment }));
setLatitude(formatLatLongNumber(simState.lat + increment));
setLocationSearch("");
// TODO: commenting these out prevents the "glitch"
// but lets test other examples of these being called and see if they are glitchy
// there might be something circular going on?
//setLatitude(formatLatLongNumber(simState.lat + increment));
//setLocationSearch("");
}

const handleLongSliderChange = (event: any, ui: any) => {
setSimState(prevState => ({ ...prevState, long: ui.value }));
setLongitude(formatLatLongNumber(ui.value));
setLocationSearch("");
//setLongitude(formatLatLongNumber(ui.value));
//setLocationSearch("");
};

const handleLongInputChange = (event: ChangeEvent<HTMLInputElement>) => {
Expand Down

0 comments on commit 5923296

Please sign in to comment.