Skip to content

Commit

Permalink
Example updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaub committed Dec 3, 2023
1 parent 88cbfa9 commit 8856c70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions site/src/components/examples/Slider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ function Slider() {

function onPrerender(event) {
const ctx = event.context;
const width = (ctx.canvas.width * percent) / 100;
const start = 0;
const end = width;

ctx.save();
ctx.beginPath();
ctx.rect(start, 0, end, ctx.canvas.height);
ctx.rect(0, 0, (ctx.canvas.width * percent) / 100, ctx.canvas.height);
ctx.clip();
}

Expand All @@ -39,8 +35,10 @@ function Slider() {
type="range"
min={0}
max={100}
step={0.25}
style={{width: '100%'}}
value={percent}
onChange={event => updatePercent(event.target.value)}
onChange={event => updatePercent(parseInt(event.target.value))}
/>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion site/src/content/examples/slider.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Slider Compare'
title: 'Comparison Slider'
level: 1
description: |
This example shows a range slider can be used to compare two layers. The
Expand Down

0 comments on commit 8856c70

Please sign in to comment.