fix(hotkey): The skill indicator issue

This commit is contained in:
AkiChase 2024-05-02 16:10:41 +08:00
parent 2781658bc8
commit 6278a85aea
2 changed files with 8 additions and 5 deletions

View File

@ -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"

View File

@ -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) {