Skip to content

Commit

Permalink
Make GUI appear on top of other elements
Browse files Browse the repository at this point in the history
I was surprised to learn that this didn't default
to z-Index > 0. I think it works in most apps because
it's expected not to call the GUI constructor until after
your other elements have been created? (I didn't look
too deeply)

It's possible you might want to move elements, see
#330
But in any case, it seemed like a good default.
  • Loading branch information
greggman committed Nov 22, 2023
1 parent 4987544 commit c6a94aa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/SampleLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ const SampleLayout: React.FunctionComponent<
if (props.gui && process.browser) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const dat = require('dat.gui');
return new dat.GUI({ autoPlace: false });
const gui = new dat.GUI({ autoPlace: false });
// HACK: Make
gui.domElement.style.position = 'relative';
gui.domElement.style.zIndex = '1000';
return gui;
}
return undefined;
}, []);
Expand Down

0 comments on commit c6a94aa

Please sign in to comment.