Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
froyo-np committed Nov 19, 2024
1 parent c889c93 commit 4ad7255
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions examples/src/omezarr/sliceview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function SliceView(props: Props) {
const server = useContext(renderServerContext);
const cnvs = useRef<HTMLCanvasElement>(null);
const renderer = useRef<ReturnType<typeof buildAsyncOmezarrRenderer>>();
const [view, setView] = useState<box2D>(Box2D.create([0, 0], [250, 120]))
const [view, setView] = useState<box2D>(Box2D.create([0, 0], [250, 120]));
useEffect(() => {
if (server && server.regl) {
renderer.current = buildAsyncOmezarrRenderer(server.regl, defaultDecoder);
Expand All @@ -52,7 +52,13 @@ export function SliceView(props: Props) {
if (server && renderer.current && cnvs.current && omezarr) {
const hey: RenderFrameFn<ZarrDataset, VoxelTile> = (target, cache, callback) => {
if (renderer.current) {
return renderer.current(omezarr, {...settings, camera:{...settings.camera,view}}, callback, target, cache);
return renderer.current(
omezarr,
{ ...settings, camera: { ...settings.camera, view } },
callback,
target,
cache
);
}
return null;
};
Expand All @@ -75,12 +81,12 @@ export function SliceView(props: Props) {
cnvs.current
);
}
}, [server, renderer.current, cnvs.current, omezarr,view]);
}, [server, renderer.current, cnvs.current, omezarr, view]);
return (
<canvas
id={'hey there'}
ref={cnvs}
onWheel={(e)=>{
onWheel={(e) => {
const scale = e.deltaY > 0 ? 1.1 : 0.9;
const m = Box2D.midpoint(view);
const v = Box2D.translate(Box2D.scale(Box2D.translate(view, Vec2.scale(m, -1)), [scale, scale]), m);
Expand Down

0 comments on commit 4ad7255

Please sign in to comment.