Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/core/double-click/double-click.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ export const handleDoubleClickResetMode = (
function getDoubleClickScale(
mode: LibrarySetup["doubleClick"]["mode"],
scale: number,
initialScale?: number,
) {
if (mode === "toggle") {
return scale === 1 ? 1 : -1;
return scale === (initialScale ?? 1) ? 1 : -1;
}

return mode === "zoomOut" ? -1 : 1;
Expand All @@ -76,7 +77,7 @@ export function handleDoubleClick(

if (!contentComponent) return console.error("No ContentComponent found");

const delta = getDoubleClickScale(mode, contextInstance.transformState.scale);
const delta = getDoubleClickScale(mode, contextInstance.transformState.scale, contextInstance.props.initialScale);

const newScale = handleCalculateButtonZoom(contextInstance, delta, step);

Expand Down