Skip to content

Commit

Permalink
v0.10.11: Fix scrolling bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaMulein committed Nov 9, 2024
1 parent cc6e81d commit 26ee1c7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ Join our community of developers.
## Changelog
### Sat Nov 09 14:20:00 2024
- Version 0.10.11
- Fixed bug that applied common actions while scrolling the options
### Sat Nov 09 13:58:00 2024
- Version 0.10.10
Expand Down
14 changes: 14 additions & 0 deletions src/components/RecipeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,23 @@ export const RecipesList: FC<RecipesProps> = ({
onClick,
}) => {
const [activeRecipeKey, setActiveRecipeKey] = useState<RecipeKey | null>(null);
const [isScrolling, setIsScrolling] = useState(false);

const handleTouchStart = () => {
setIsScrolling(false);
};

const handleTouchMove = () => {
setIsScrolling(true);
};

const handleClick = useCallback(
(
event: MouseEvent<HTMLDivElement> | TouchEvent<HTMLDivElement>,
section: RecipeSections,
recipeKey: RecipeKey
) => {
if (isScrolling) return;
onClick(event, section, recipeKey);
setActiveRecipeKey(recipeKey);

Expand Down Expand Up @@ -155,8 +165,12 @@ export const RecipesList: FC<RecipesProps> = ({
padding: '4px 8px',
}}
onClick={(e) => e.stopPropagation()} // Prevent clicks from bubbling up
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
>
<MemoizedRecipeCard
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onHover={onHover}
onLeave={onLeave}
onClick={handleClick}
Expand Down
2 changes: 1 addition & 1 deletion src/game/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { IRisingSunFeatures } from '@/game/interfaces/set-features/rising-sun';
import { IExpansionsEnabled } from '@/game/interfaces/expansions-enabled';
import { calculateInitialSunTokens } from '@/game/interfaces/set-mats/prophecy';

export const VERSION_NUMBER = '0.10.10';
export const VERSION_NUMBER = '0.10.11';
export const LAST_COMPATIBLE_SAVE_VERSION = '0.10.0';

export const MIN_PLAYERS = 2;
Expand Down

0 comments on commit 26ee1c7

Please sign in to comment.