You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
796 B
32 lines
796 B
import electron from "@/plugins/electron"
|
|
import { useEffect } from "react"
|
|
|
|
|
|
export default function() {
|
|
useEffect(() => {
|
|
let biasX = 0
|
|
let biasY = 0
|
|
document.addEventListener("mousedown", function(e) {
|
|
switch (e.button) {
|
|
case 0:
|
|
biasX = e.x
|
|
biasY = e.y
|
|
document.addEventListener("mousemove", moveEvent)
|
|
break
|
|
case 2:
|
|
electron.ipcRenderer.send("@func:float:showRightMenu")
|
|
break
|
|
}
|
|
})
|
|
|
|
document.addEventListener("mouseup", function() {
|
|
biasX = 0
|
|
biasY = 0
|
|
document.removeEventListener("mousemove", moveEvent)
|
|
})
|
|
|
|
function moveEvent(e: any) {
|
|
electron.ipcRenderer.send("@func:buildin:setPosition", e.screenX - biasX, e.screenY - biasY)
|
|
}
|
|
}, [])
|
|
}
|
|
|