mirror of
https://github.com/AkiChase/scrcpy-mask
synced 2025-02-22 23:12:16 +08:00
fix(hotkey): The skill indicator issue
This commit is contained in:
parent
2781658bc8
commit
6278a85aea
@ -67,7 +67,7 @@ function toStartServer() {
|
||||
<div @contextmenu.prevent class="mask" id="maskElement"></div>
|
||||
<div class="button-layer">
|
||||
<!-- <div style="position: absolute;height: 100%;width: 1px;background-color: red;left: 50%;"></div>
|
||||
<div style="position: absolute;width: 100%;height: 1px;background-color: red;top: 55%;"></div> -->
|
||||
<div style="position: absolute;width: 100%;height: 1px;background-color: red;top: 56.6%;"></div> -->
|
||||
<template
|
||||
v-for="button in store.keyMappingConfigList[store.curKeyMappingIndex]
|
||||
.list"
|
||||
|
@ -40,16 +40,19 @@ function clientyToPosOffsety(clienty: number, posy: number, scale = 1) {
|
||||
return Math.round(offsetY * scale);
|
||||
}
|
||||
|
||||
// TODO ? 技能指示器的指向实际上是有投影变换的(可见王者技能范围不是圆而是椭圆),需要一定的算法,不能仅仅相对(x:50%, y:55%)的位置
|
||||
|
||||
function clientPosToSkillOffset(
|
||||
clientPos: { x: number; y: number },
|
||||
range: number
|
||||
): { offsetX: number; offsetY: number } {
|
||||
const maxLength = (100 / maskSizeH) * screenSizeH;
|
||||
const centerX = maskSizeW * 0.5;
|
||||
const centerY = maskSizeH * 0.55;
|
||||
const cOffsetX = clientPos.x - 70 - centerX;
|
||||
const centerY = maskSizeH * 0.5;
|
||||
|
||||
// The center of the game display is higher than the center of the mask
|
||||
clientPos.y -= maskSizeH * 0.066;
|
||||
|
||||
// w450 : h315 = 100 : 70, so the true offsetX is 0.7 * cOffsetX
|
||||
const cOffsetX = (clientPos.x - 70 - centerX)*0.7;
|
||||
const cOffsetY = clientPos.y - 30 - centerY;
|
||||
const offsetD = Math.sqrt(cOffsetX ** 2 + cOffsetY ** 2);
|
||||
if (offsetD == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user