fixed # 修复部分样式BUG

This commit is contained in:
2026-11-24 12:08:04 +08:00
parent 2d7bd0fbdc
commit 98116bef7b
17 changed files with 605 additions and 73 deletions
+20 -8
View File
@@ -79,22 +79,34 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
function removeAim() { aim?.remove(); aim = null; }
function showAim(card, point) {
const rect = card.getBoundingClientRect();
const x = rect.left + rect.width / 2, y = rect.top + Math.min(12, rect.height / 2);
const dx = point.x - x, dy = point.y - y;
const length = Math.hypot(dx, dy);
if (!(rect.width > 0 && rect.height > 0 && length > 0 && Number.isFinite(length))) {
const x = rect.left + rect.width / 2, y = rect.top;
if (!(rect.width > 0 && rect.height > 0 && Number.isFinite(point.x) && Number.isFinite(point.y))) {
removeAim();
return;
}
if (!aim) {
aim = document.createElement("div");
const svg = "http://www.w3.org/2000/svg";
aim = document.createElementNS(svg, "svg");
aim.classList.add("mengsan-hand-aim-shuying");
aim.setAttribute("aria-hidden", "true");
// 无名杀缩放 body,牌面矩形和指针事件都使用视口坐标。
aim.appendChild(document.createElementNS(svg, "line"));
document.documentElement.appendChild(aim);
}
aim.style.width = `${length}px`;
aim.style.transform = `translate(${x}px, ${y}px) rotate(${Math.atan2(dy, dx)}rad) translateY(-50%)`;
// 牌面和触点在同一个视口坐标系,统一换算到绘制层的局部坐标。
const matrix = aim.getScreenCTM();
const determinant = matrix && matrix.a * matrix.d - matrix.b * matrix.c;
if (!determinant || !Number.isFinite(determinant)) { removeAim(); return; }
const inverse = matrix.inverse();
const viewportPoint = aim.createSVGPoint();
viewportPoint.x = x; viewportPoint.y = y;
const from = viewportPoint.matrixTransform(inverse);
viewportPoint.x = point.x; viewportPoint.y = point.y;
const to = viewportPoint.matrixTransform(inverse);
const line = aim.firstElementChild;
line.setAttribute("x1", from.x);
line.setAttribute("y1", from.y);
line.setAttribute("x2", to.x);
line.setAttribute("y2", to.y);
}
function clearSelection(state) {
if (!live(state) || !state.selected) return;
+10 -8
View File
@@ -78,16 +78,18 @@
}
.mengsan-hand-aim-shuying {
position: fixed;
top: 0;
left: 0;
height: 2.6px;
inset: 0;
width: 100%;
height: 100%;
z-index: 1000;
pointer-events: none;
transform-origin: 0 0;
transition: none;
border-radius: 2px;
background: rgb(250, 220, 140);
box-shadow: 0 0 2px #f5d25b;
}
.mengsan-hand-aim-shuying > line {
stroke: rgb(250, 220, 140);
stroke-width: 2.6px;
stroke-linecap: round;
vector-effect: non-scaling-stroke;
filter: drop-shadow(0 0 2px #f5d25b);
}
/* 只在梦三手牌挂载期间隐藏十周年阶段、等待响应和对方思考图片。 */
body.mengsan-hand-ui-shuying [style*="extension/十周年UI/ui/assets/lbtn/tips/"]:is(