Skip to content

Commit

Permalink
adjust plot centering mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
tuner committed Jan 9, 2025
1 parent a1fdd14 commit cc4baff
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/gui/gui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export function setupGui(
.onChange(onPatientChange);
}

const onZoomChange = (value: number) =>
((
jellyfishGui.querySelector(".jellyfish-plot") as HTMLElement
).style.transform = `scale(${value})`);
const onZoomChange = (value: number) => {
const plot = jellyfishGui.querySelector(".jellyfish-plot") as HTMLElement;
plot.style.transform = `translate(-50%, -50%) scale(${value})`;
};

gui.add(generalProps, "zoom", 0.2, 2).onChange(onZoomChange);

Expand Down Expand Up @@ -248,7 +248,9 @@ function makePatientNavigator(
const HTML_TEMPLATE = `
<div class="jellyfish-gui">
<div class="jellyfish-plot-container">
<div class="jellyfish-plot"></div>
<div class="jellyfish-center">
<div class="jellyfish-plot"></div>
</div>
</div>
<div class="jellyfish-patient-nav" style="display: none">
<button class="jellyfish-prev-patient">
Expand Down
14 changes: 12 additions & 2 deletions style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cc4baff

Please sign in to comment.