🔨 优化拖拽方案

This commit is contained in:
layyback
2023-04-01 16:59:48 +08:00
parent 1fa0b9fb9c
commit b42bc6461d
3 changed files with 64 additions and 41 deletions

View File

@@ -6,6 +6,7 @@ import {
Notification,
nativeImage,
clipboard,
screen,
shell,
} from 'electron';
import { runner, detach } from '../browsers';
@@ -55,6 +56,13 @@ class API {
}
};
public windowMoving({ data: { mouseX, mouseY, width, height } }, window, e) {
const { x, y } = screen.getCursorScreenPoint();
const originWindow = this.getCurrentWindow(window, e);
if (!originWindow) return;
originWindow.setBounds({ x: x - mouseX, y: y - mouseY });
}
public loadPlugin({ data: plugin }, window) {
window.webContents.executeJavaScript(
`window.loadPlugin(${JSON.stringify(plugin)})`