Skip to content

Commit

Permalink
fix: zoom scales smoothen
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Apr 28, 2020
1 parent 340083f commit 36ff168
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ui/blocks/src/Playground/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ export const Playground: FC<PlaygroundProps> = ({
}),
[userActions],
);

const zoomActions = React.useMemo(
() => [
{
Expand All @@ -128,7 +127,10 @@ export const Playground: FC<PlaygroundProps> = ({
},
{
title: (
<Button onClick={() => setScale(scale / 2)} aria-label="zoom out">
<Button
onClick={() => setScale(Math.max(0.5, scale - 0.2))}
aria-label="zoom out"
>
<Octicon icon={Dash} />
</Button>
),
Expand All @@ -137,15 +139,18 @@ export const Playground: FC<PlaygroundProps> = ({
},
{
title: (
<Button onClick={() => setScale(scale * 2)} aria-label="zoom in">
<Button
onClick={() => setScale(Math.min(3, scale + 0.2))}
aria-label="zoom in"
>
<Octicon icon={Plus} />
</Button>
),
id: 'zoomin',
group: 'zoom',
},
],
[],
[scale],
);
const actionsItems = userScale
? [...zoomActions, ...panelActions]
Expand Down

0 comments on commit 36ff168

Please sign in to comment.