fix: limit selection btn in window & click to hide

This commit is contained in:
Gabe Yuan
2024-04-12 22:28:40 +08:00
parent 7379ff8d15
commit 923d3293cd
2 changed files with 12 additions and 3 deletions

View File

@@ -1,8 +1,17 @@
import { isMobile } from "../../libs/mobile";
import { limitNumber } from "../../libs/utils";
export default function TranBtn({ onClick, position, tranboxSetting }) {
const left = position.x + tranboxSetting.btnOffsetX;
const top = position.y + tranboxSetting.btnOffsetY;
const left = limitNumber(
position.x + tranboxSetting.btnOffsetX,
0,
window.innerWidth - 32
);
const top = limitNumber(
position.y + tranboxSetting.btnOffsetY,
0,
window.innerHeight - 32
);
const touchProps = isMobile
? {