fix: Try to fix touch drag

#456
This commit is contained in:
MystiPanda 2024-03-11 12:36:20 +08:00
parent 35dabaab9c
commit 18fdc5c6a2
4 changed files with 14 additions and 16 deletions

View File

@ -60,6 +60,6 @@ body {
-ms-user-select: none; -ms-user-select: none;
} }
[data-windrag] { [data-tauri-drag-region] {
app-region: drag; app-region: drag;
} }

View File

@ -91,12 +91,13 @@
// background-color: var(--background-color-alpha); // background-color: var(--background-color-alpha);
.the-bar { .the-bar {
position: absolute; // position: absolute;
top: 0px; // top: 0px;
right: 0px; // right: 0px;
height: 24px; height: 24px;
display: flex; display: flex;
align-items: center; // align-items: center;
justify-content: end;
box-sizing: border-box; box-sizing: border-box;
z-index: 2; z-index: 2;
} }

View File

@ -20,10 +20,10 @@ export const BasePage: React.FC<Props> = (props) => {
return ( return (
<BaseErrorBoundary> <BaseErrorBoundary>
<div className="base-page"> <div className="base-page">
<header data-windrag style={{ userSelect: "none" }}> <header data-tauri-drag-region="true" style={{ userSelect: "none" }}>
<Typography <Typography
sx={{ fontSize: "20px", fontWeight: "700 " }} sx={{ fontSize: "20px", fontWeight: "700 " }}
data-windrag data-tauri-drag-region="true"
> >
{title} {title}
</Typography> </Typography>

View File

@ -104,9 +104,6 @@ const Layout = () => {
square square
elevation={0} elevation={0}
className={`${OS} layout`} className={`${OS} layout`}
onPointerDown={(e: any) => {
if (e.target?.dataset?.windrag) appWindow.startDragging();
}}
onContextMenu={(e) => { onContextMenu={(e) => {
// only prevent it on Windows // only prevent it on Windows
const validList = ["input", "textarea"]; const validList = ["input", "textarea"];
@ -127,10 +124,10 @@ const Layout = () => {
}), }),
]} ]}
> >
<div className="layout__left" data-windrag> <div className="layout__left" data-tauri-drag-region="true">
<div className="the-logo" data-windrag> <div className="the-logo" data-tauri-drag-region="true">
{!isDark ? <LogoSvg /> : <LogoSvg_dark />} {!isDark ? <LogoSvg /> : <LogoSvg_dark />}
{!portableFlag && <UpdateButton className="the-newbtn" />} {<UpdateButton className="the-newbtn" />}
</div> </div>
<List className="the-menu"> <List className="the-menu">
@ -145,14 +142,14 @@ const Layout = () => {
))} ))}
</List> </List>
<div className="the-traffic" data-windrag> <div className="the-traffic">
<LayoutTraffic /> <LayoutTraffic />
</div> </div>
</div> </div>
<div className="layout__right" data-windrag> <div className="layout__right">
{OS === "windows" && ( {OS === "windows" && (
<div className="the-bar"> <div className="the-bar" data-tauri-drag-region="true">
<LayoutControl /> <LayoutControl />
</div> </div>
)} )}