mirror of
https://github.com/AkiChase/scrcpy-mask
synced 2025-02-22 23:12:16 +08:00
bug(Key): fix drag range
This commit is contained in:
parent
19c81ec743
commit
a4a29fdb5e
@ -118,6 +118,8 @@ function toStartServer() {
|
||||
border-right: 1px solid var(--bg-color);
|
||||
border-bottom: 1px solid var(--bg-color);
|
||||
border-radius: 0 0 5px 0;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
|
||||
& > .mask-button {
|
||||
position: absolute;
|
||||
|
@ -53,16 +53,16 @@ function dragHandler(downEvent: MouseEvent) {
|
||||
const keyboardElement = document.getElementById(
|
||||
"keyboardElement"
|
||||
) as HTMLElement;
|
||||
const maxX = keyboardElement.clientWidth - 40;
|
||||
const maxY = keyboardElement.clientHeight - 40;
|
||||
const maxX = keyboardElement.clientWidth - 20;
|
||||
const maxY = keyboardElement.clientHeight - 20;
|
||||
|
||||
const x = downEvent.clientX;
|
||||
const y = downEvent.clientY;
|
||||
const moveHandler = (moveEvent: MouseEvent) => {
|
||||
let newX = oldX + moveEvent.clientX - x;
|
||||
let newY = oldY + moveEvent.clientY - y;
|
||||
newX = Math.max(0, Math.min(newX, maxX));
|
||||
newY = Math.max(0, Math.min(newY, maxY));
|
||||
newX = Math.max(20, Math.min(newX, maxX));
|
||||
newY = Math.max(20, Math.min(newY, maxY));
|
||||
keyMapping.value.posX = newX;
|
||||
keyMapping.value.posY = newY;
|
||||
};
|
||||
@ -292,6 +292,7 @@ function showSetting() {
|
||||
position: absolute;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
border: 2px solid var(--blue-color);
|
||||
display: flex;
|
||||
|
@ -36,16 +36,16 @@ function dragHandler(downEvent: MouseEvent) {
|
||||
const keyboardElement = document.getElementById(
|
||||
"keyboardElement"
|
||||
) as HTMLElement;
|
||||
const maxX = keyboardElement.clientWidth - 60;
|
||||
const maxY = keyboardElement.clientHeight - 60;
|
||||
const maxX = keyboardElement.clientWidth - 30;
|
||||
const maxY = keyboardElement.clientHeight - 30;
|
||||
|
||||
const x = downEvent.clientX;
|
||||
const y = downEvent.clientY;
|
||||
const moveHandler = (moveEvent: MouseEvent) => {
|
||||
let newX = oldX + moveEvent.clientX - x;
|
||||
let newY = oldY + moveEvent.clientY - y;
|
||||
newX = Math.max(0, Math.min(newX, maxX));
|
||||
newY = Math.max(0, Math.min(newY, maxY));
|
||||
newX = Math.max(30, Math.min(newX, maxX));
|
||||
newY = Math.max(30, Math.min(newY, maxY));
|
||||
keyMapping.value.posX = newX;
|
||||
keyMapping.value.posY = newY;
|
||||
};
|
||||
@ -166,6 +166,7 @@ function showSetting() {
|
||||
position: absolute;
|
||||
height: 60px;
|
||||
width: 60px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
border: 2px solid var(--blue-color);
|
||||
display: flex;
|
||||
|
@ -45,16 +45,16 @@ function dragHandler(downEvent: MouseEvent) {
|
||||
const keyboardElement = document.getElementById(
|
||||
"keyboardElement"
|
||||
) as HTMLElement;
|
||||
const maxX = keyboardElement.clientWidth - 60;
|
||||
const maxY = keyboardElement.clientHeight - 60;
|
||||
const maxX = keyboardElement.clientWidth - 30;
|
||||
const maxY = keyboardElement.clientHeight - 30;
|
||||
|
||||
const x = downEvent.clientX;
|
||||
const y = downEvent.clientY;
|
||||
const moveHandler = (moveEvent: MouseEvent) => {
|
||||
let newX = oldX + moveEvent.clientX - x;
|
||||
let newY = oldY + moveEvent.clientY - y;
|
||||
newX = Math.max(0, Math.min(newX, maxX));
|
||||
newY = Math.max(0, Math.min(newY, maxY));
|
||||
newX = Math.max(30, Math.min(newX, maxX));
|
||||
newY = Math.max(30, Math.min(newY, maxY));
|
||||
keyMapping.value.posX = newX;
|
||||
keyMapping.value.posY = newY;
|
||||
};
|
||||
@ -290,7 +290,7 @@ function updateRangeIndicator(element?: HTMLElement) {
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: auto;
|
||||
|
||||
border-radius: 50%;
|
||||
background-color: var(--blue-color);
|
||||
clip-path: polygon(0 0, 100% 0, 50% 25%);
|
||||
}
|
||||
@ -314,6 +314,7 @@ function updateRangeIndicator(element?: HTMLElement) {
|
||||
height: 60px;
|
||||
width: 60px;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
border: 2px solid var(--blue-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
Loading…
Reference in New Issue
Block a user