JavaScript 65.5%
Python 17.8%
CSS 13%
HTML 3.7%
1/*2 * noVNC: HTML5 VNC client3 * Copyright (C) 2020 The noVNC authors4 * Licensed under MPL 2.0 (see LICENSE.txt)5 *6 * See README.md for usage and integration instructions.7 */89/*10 * HTML element utility functions11 */1213export function clientToElement(x, y, elem) {14 const bounds = elem.getBoundingClientRect();15 let pos = { x: 0, y: 0 };16 // Clip to target bounds17 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}33