mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 21:14:21 +08:00
Merge pull request #21 from SECTL/qwen-code-c1f9931c-c242-4e77-bdc4-070864e28e6e
Update from task c1f9931c-c242-4e77-bdc4-070864e28e6e
This commit is contained in:
+32
-48
@@ -1,59 +1,43 @@
|
||||
```
|
||||
# Dependencies
|
||||
node_modules
|
||||
.pnp
|
||||
.pnp.js
|
||||
node_modules/
|
||||
target/
|
||||
|
||||
# Build outputs
|
||||
dist
|
||||
dist-ssr
|
||||
out
|
||||
*.local
|
||||
|
||||
# Tauri
|
||||
src-tauri/target
|
||||
src-tauri/Cargo.lock
|
||||
src-tauri/gen
|
||||
.cargo-local/
|
||||
|
||||
# Database
|
||||
data.sql
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
*.db
|
||||
*.db-shm
|
||||
*.db-wal
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.DS_Store
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# Environment files
|
||||
# Environment
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
*.env.*
|
||||
|
||||
# Testing
|
||||
coverage
|
||||
|
||||
# Cache
|
||||
# Python
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
.Python
|
||||
env/
|
||||
venv/
|
||||
.venv/
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
.temp
|
||||
.tmp
|
||||
.eslintcache
|
||||
# OS files
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.log
|
||||
.git/modules/
|
||||
*.sublime-workspace
|
||||
.pytest_cache/
|
||||
.hypothesis/
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
```
|
||||
@@ -152,3 +152,20 @@ pub async fn window_set_resizable(
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn window_start_dragging(
|
||||
app: AppHandle,
|
||||
_state: tauri::State<'_, Arc<RwLock<AppState>>>,
|
||||
) -> Result<(), String> {
|
||||
#[cfg(not(desktop))]
|
||||
{
|
||||
let _ = app;
|
||||
}
|
||||
|
||||
#[cfg(desktop)]
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
window.start_dragging().map_err(|e| e.to_string())?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -143,6 +143,83 @@ const disableTouchZoom = () => {
|
||||
}
|
||||
disableTouchZoom()
|
||||
|
||||
// 桌面端触屏窗口拖动支持
|
||||
const enableTouchWindowDrag = () => {
|
||||
const api = (window as any).api
|
||||
if (!api) return
|
||||
|
||||
let touchStartX = 0
|
||||
let touchStartY = 0
|
||||
let isDragging = false
|
||||
let dragElement: Element | null = null
|
||||
|
||||
document.addEventListener(
|
||||
"touchstart",
|
||||
(event) => {
|
||||
const target = event.target as Element
|
||||
if (!target) return
|
||||
|
||||
// 检查是否在可拖动区域内
|
||||
const dragRegion = target.closest('[data-tauri-drag-region]')
|
||||
if (!dragRegion) return
|
||||
|
||||
// 检查是否点击了不可拖动的元素(如按钮)
|
||||
const noDragElement = target.closest('button, input, select, a, [role="button"]')
|
||||
if (noDragElement) return
|
||||
|
||||
const touch = event.touches[0]
|
||||
if (!touch) return
|
||||
|
||||
touchStartX = touch.clientX
|
||||
touchStartY = touch.clientY
|
||||
isDragging = true
|
||||
dragElement = dragRegion
|
||||
},
|
||||
{ passive: true }
|
||||
)
|
||||
|
||||
document.addEventListener(
|
||||
"touchmove",
|
||||
(event) => {
|
||||
if (!isDragging || !dragElement) return
|
||||
|
||||
const touch = event.touches[0]
|
||||
if (!touch) return
|
||||
|
||||
const deltaX = touch.clientX - touchStartX
|
||||
const deltaY = touch.clientY - touchStartY
|
||||
|
||||
// 只有当移动距离超过阈值时才认为是拖动窗口
|
||||
if (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3) {
|
||||
event.preventDefault()
|
||||
api.startDraggingWindow?.()
|
||||
isDragging = false
|
||||
dragElement = null
|
||||
}
|
||||
},
|
||||
{ passive: false }
|
||||
)
|
||||
|
||||
document.addEventListener(
|
||||
"touchend",
|
||||
() => {
|
||||
isDragging = false
|
||||
dragElement = null
|
||||
},
|
||||
{ passive: true }
|
||||
)
|
||||
|
||||
document.addEventListener(
|
||||
"touchcancel",
|
||||
() => {
|
||||
isDragging = false
|
||||
dragElement = null
|
||||
},
|
||||
{ passive: true }
|
||||
)
|
||||
}
|
||||
enableTouchWindowDrag()
|
||||
|
||||
const platform = navigator.userAgent.toLowerCase()
|
||||
const isIos = /iphone|ipad|ipod/.test(platform)
|
||||
const isAndroid = platform.includes("android")
|
||||
|
||||
@@ -218,6 +218,7 @@ const api = {
|
||||
windowMaximize: (): Promise<boolean> => invoke("window_maximize"),
|
||||
windowClose: (): Promise<void> => invoke("window_close"),
|
||||
windowIsMaximized: (): Promise<boolean> => invoke("window_is_maximized"),
|
||||
startDraggingWindow: (): Promise<void> => invoke("window_start_dragging"),
|
||||
toggleDevTools: (): Promise<void> => invoke("toggle_devtools"),
|
||||
windowResize: (width: number, height: number): Promise<void> =>
|
||||
invoke("window_resize", { width, height }),
|
||||
|
||||
Reference in New Issue
Block a user