feat: auto-hide presentation toolbar when not hovered (#1923)
Some checks are pending
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / E2E Tests (win32-x64 on windows-latest) (push) Blocked by required conditions
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / E2E Tests (darwin-arm64 on macos-latest) (push) Blocked by required conditions
tinymist::ci / E2E Tests (linux-x64 on ubuntu-22.04) (push) Blocked by required conditions
tinymist::ci / E2E Tests (linux-x64 on ubuntu-latest) (push) Blocked by required conditions
tinymist::ci / E2E Tests (win32-x64 on windows-2022) (push) Blocked by required conditions
tinymist::ci / build-binary (push) Blocked by required conditions
tinymist::ci / build-vsc-assets (push) Blocked by required conditions
tinymist::ci / build-vscode (push) Blocked by required conditions
tinymist::ci / build-vscode-others (push) Blocked by required conditions
tinymist::ci / publish-vscode (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run

* docs: update changelog

* feat: auto-hide presentation toolbar when not hovered

* fix: grab state

* fix: bugs
This commit is contained in:
Myriad-Dreamin 2025-07-25 18:31:35 +08:00 committed by GitHub
parent 2dc138f4d3
commit ca22cf9e05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 25 additions and 6 deletions

View file

@ -37,6 +37,7 @@ The changelog lines unspecified with authors are all written by the @Myriad-Drea
### Code Analysis ### Code Analysis
* (Fix) Truncating value repr with 10MB limit in https://github.com/Myriad-Dreamin/tinymist/pull/1850 * (Fix) Truncating value repr with 10MB limit in https://github.com/Myriad-Dreamin/tinymist/pull/1850
* (Fix) Updated the docs link from `pattern` to `tiling` by @YDX-2147483647 in https://github.com/Myriad-Dreamin/tinymist/pull/1906
* Resolving definitions with dynamic analysis in https://github.com/Myriad-Dreamin/tinymist/pull/1904 * Resolving definitions with dynamic analysis in https://github.com/Myriad-Dreamin/tinymist/pull/1904
### Docstring ### Docstring
@ -64,6 +65,7 @@ The changelog lines unspecified with authors are all written by the @Myriad-Drea
* Added flake.nix in https://github.com/Myriad-Dreamin/tinymist/pull/1843 * Added flake.nix in https://github.com/Myriad-Dreamin/tinymist/pull/1843
* Removed debug symbol links in https://github.com/Myriad-Dreamin/tinymist/pull/1836 * Removed debug symbol links in https://github.com/Myriad-Dreamin/tinymist/pull/1836
* Generating typlite, config reference markdown files in https://github.com/Myriad-Dreamin/tinymist/pull/1868, https://github.com/Myriad-Dreamin/tinymist/pull/1881, https://github.com/Myriad-Dreamin/tinymist/pull/1885, and https://github.com/Myriad-Dreamin/tinymist/pull/1886 * Generating typlite, config reference markdown files in https://github.com/Myriad-Dreamin/tinymist/pull/1868, https://github.com/Myriad-Dreamin/tinymist/pull/1881, https://github.com/Myriad-Dreamin/tinymist/pull/1885, and https://github.com/Myriad-Dreamin/tinymist/pull/1886
* Added software specification for LLM in https://github.com/Myriad-Dreamin/tinymist/pull/1917 and https://github.com/Myriad-Dreamin/tinymist/pull/1918
**Full Changelog**: https://github.com/Myriad-Dreamin/tinymist/compare/v0.13.14...v0.13.16 **Full Changelog**: https://github.com/Myriad-Dreamin/tinymist/compare/v0.13.14...v0.13.16

View file

@ -163,7 +163,7 @@
<!-- reserving 1px to hide height border, margin-top: -1px; --> <!-- reserving 1px to hide height border, margin-top: -1px; -->
<div id="typst-container" style="width: 100%"> <div id="typst-container" style="width: 100%">
<div id="typst-container-top" style="width: 100%; z-index: 1"> <div id="typst-container-top" style="width: 100%; z-index: 1">
<div id="typst-top-toolbar" style="width: 100%"> <div id="typst-top-toolbar" style="width: calc(100% - 24px)">
<div <div
id="typst-top-toolbar-start" id="typst-top-toolbar-start"
class="flex-row" class="flex-row"

View file

@ -14,10 +14,21 @@ export function setupDrag() {
}; };
moved = true; moved = true;
}; };
const goodDrag = (element: HTMLElement | null): element is HTMLElement => {
if (!element) return false;
// is not child of id=typst-container-top
while (element) {
if (element.id === "typst-container-top") {
return false;
}
element = element.parentElement;
}
return true;
};
const mouseUpHandler = function () { const mouseUpHandler = function () {
document.removeEventListener("mousemove", mouseMoveHandler); document.removeEventListener("mousemove", mouseMoveHandler);
document.removeEventListener("mouseup", mouseUpHandler); document.removeEventListener("mouseup", mouseUpHandler);
if (!containerElement) return; if (!goodDrag(containerElement)) return;
if (!moved) { if (!moved) {
document.getSelection()?.removeAllRanges(); document.getSelection()?.removeAllRanges();
} }
@ -29,7 +40,7 @@ export function setupDrag() {
x: e.clientX, x: e.clientX,
y: e.clientY, y: e.clientY,
}; };
if (!containerElement) return; if (!goodDrag(containerElement)) return;
const elementUnderMouse = e.target as HTMLElement | null; const elementUnderMouse = e.target as HTMLElement | null;
if (elementUnderMouse !== null && elementUnderMouse.classList.contains("tsel")) { if (elementUnderMouse !== null && elementUnderMouse.classList.contains("tsel")) {
return; return;

View file

@ -71,10 +71,16 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
flex: 1; flex: 1;
max-height: calc(100vh - 35px); max-height: 100vh;
} }
#typst-container.mode-slide #typst-container-top { #typst-container.mode-slide #typst-container-top {
flex: 0 0 35px; height: 35px;
display: flex; position: absolute;
opacity: 0;
transition: opacity 0.1s ease;
} }
#typst-container.mode-slide #typst-container-top:hover {
opacity: 1;
}