跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

element.js

32 行 · 729 B历史下载
1/*
2 * noVNC: HTML5 VNC client
3 * Copyright (C) 2020 The noVNC authors
4 * Licensed under MPL 2.0 (see LICENSE.txt)
5 *
6 * See README.md for usage and integration instructions.
7 */
8
9/*
10 * HTML element utility functions
11 */
12
13export function clientToElement(x, y, elem) {
14 const bounds = elem.getBoundingClientRect();
15 let pos = { x: 0, y: 0 };
16 // Clip to target bounds
17 if (x < bounds.left) {
18 pos.x = 0;
19 } else if (x >= bounds.right) {
20 pos.x = bounds.width - 1;
21 } else {
22 pos.x = x - bounds.left;
23 }
24 if (y < bounds.top) {
25 pos.y = 0;
26 } else if (y >= bounds.bottom) {
27 pos.y = bounds.height - 1;
28 } else {
29 pos.y = y - bounds.top;
30 }
31 return pos;
32}