mirror of
https://github.com/rubickCenter/rubick
synced 2025-07-19 22:31:26 +08:00
bugfix: 修复无边框拖拽问题
This commit is contained in:
parent
78f54ef02b
commit
25957c485e
@ -106,6 +106,7 @@ class Listener {
|
||||
this.reRegisterShortCut(mainWindow);
|
||||
this.changeSize(mainWindow);
|
||||
this.msgTrigger(mainWindow);
|
||||
this.windowMoveInit(mainWindow);
|
||||
}
|
||||
|
||||
colorPicker() {
|
||||
@ -118,6 +119,7 @@ class Listener {
|
||||
|
||||
picker.getWindow().on('close', () => {
|
||||
ioHook.stop();
|
||||
ioHook.removeAllListeners();
|
||||
!this.isWin && ioHook.unload();
|
||||
});
|
||||
|
||||
@ -147,7 +149,7 @@ class Listener {
|
||||
ipcMain.on("closePicker", () => {
|
||||
this.closePicker();
|
||||
});
|
||||
});
|
||||
|
||||
ioHook.on('mousemove', e => {
|
||||
let {x, y} = this.getPos(e);
|
||||
if (!picker.getWindow()) return;
|
||||
@ -171,6 +173,7 @@ class Listener {
|
||||
this.closePicker()
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
closePicker() {
|
||||
@ -288,6 +291,36 @@ class Listener {
|
||||
// todo win
|
||||
});
|
||||
}
|
||||
|
||||
windowMoveInit(win) {
|
||||
let hasInit = false;
|
||||
ipcMain.on('window-move', () => {
|
||||
if (!hasInit) {
|
||||
hasInit = true;
|
||||
ioHook.start(false);
|
||||
!this.isWin && ioHook.load();
|
||||
|
||||
const winPosition = win.getPosition();
|
||||
const winStartPosition = { x: winPosition[0], y: winPosition[1] };
|
||||
const mouseStartPosition = screen.getCursorScreenPoint();
|
||||
|
||||
ioHook.on('mousedrag', e => {
|
||||
const cursorPosition = screen.getCursorScreenPoint();
|
||||
const dx = winStartPosition.x + cursorPosition.x - mouseStartPosition.x;
|
||||
const dy = winStartPosition.y + cursorPosition.y - mouseStartPosition.y;
|
||||
let {x, y} = this.getPos({x: dx, y: dy});
|
||||
win.setPosition(parseInt(x), parseInt(y));
|
||||
});
|
||||
|
||||
ioHook.on('mouseup', e => {
|
||||
hasInit = false;
|
||||
ioHook.stop();
|
||||
ioHook.removeAllListeners();
|
||||
!this.isWin && ioHook.unload();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default Listener;
|
||||
|
@ -1,4 +1,5 @@
|
||||
<template>
|
||||
<div @mousedown="drag" >
|
||||
<a-layout id="components-layout">
|
||||
<div v-if="!searchType" class="rubick-select">
|
||||
<div class="tag-container" v-if="selected">
|
||||
@ -104,6 +105,7 @@
|
||||
</div>
|
||||
<router-view></router-view>
|
||||
</a-layout>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapActions, mapMutations, mapState } from "vuex";
|
||||
@ -309,6 +311,9 @@ export default {
|
||||
this.showMainUI();
|
||||
this.changePath({ key: "market" });
|
||||
},
|
||||
drag() {
|
||||
ipcRenderer.send('window-move');
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState("main", [
|
||||
@ -345,13 +350,9 @@ export default {
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
}
|
||||
.main-input {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
}
|
||||
.rubick-select,
|
||||
.rubick-select-subMenu {
|
||||
-webkit-app-region: drag;
|
||||
display: flex;
|
||||
padding-left: 10px;
|
||||
background: #fff;
|
||||
|
Loading…
x
Reference in New Issue
Block a user