Skip to content

Commit

Permalink
Merge pull request #1244 from sagarhedaoo/ScrollToTop-feature
Browse files Browse the repository at this point in the history
Added Scroll to top feature
  • Loading branch information
manojVivek authored Jun 7, 2024
2 parents d597425 + 5811738 commit 154f6ca
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion desktop-app/src/renderer/components/Previewer/Device/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,18 @@ const Toolbar = ({
onRotate(!rotated);
};

const scrollToTop = () => {
if (webview) {
webview.executeJavaScript(
'window.scrollTo({ top: 0, behavior: "smooth" })',
false
);
}
};

return (
<div className="flex items-center justify-between gap-1">
<div className="my-1 inline-flex max-w-[75%] items-center gap-1 overflow-x-auto">
<div className="my-1 inline-flex max-w-[78%] items-center gap-1 overflow-x-auto">
<Button onClick={refreshView} title="Refresh This View">
<Icon icon="ic:round-refresh" />
</Button>
Expand Down Expand Up @@ -187,6 +196,9 @@ const Toolbar = ({
}
/>
</Button>
<Button onClick={scrollToTop} title="Scroll to Top">
<Icon icon="ic:baseline-arrow-upward" />
</Button>
<Button onClick={toggleRulers} title="Show rulers">
<Icon icon="tdesign:measurement-1" />
</Button>
Expand Down

0 comments on commit 154f6ca

Please sign in to comment.