Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// If we haven't set the display prop. We haven't received the remote
// control start message or there was an error associating a display.
if(!this._display
&& data.type != REQUESTS.start) {
return;
}
switch(data.type) {
case EVENTS.mousemove: {
const { width, height, x, y } = this._display.bounds;
const scaleFactor = this._getDisplayScaleFactor();
const destX = data.x * width * scaleFactor + x;
const destY = data.y * height * scaleFactor + y;
if(this._mouseButtonStatus === "down") {
robot.dragMouse(destX, destY);
} else {
robot.moveMouse(destX, destY);
}
break;
}
case EVENTS.mousedown:
case EVENTS.mouseup: {
this._mouseButtonStatus
= MOUSE_ACTIONS_FROM_EVENT_TYPE[data.type];
robot.mouseToggle(
this._mouseButtonStatus,
(data.button
? MOUSE_BUTTONS[data.button] : undefined));
break;
}
case EVENTS.mousedblclick: {
robot.mouseClick(
(data.button
async mouseMoveNotification(x, y) {
await robot.setMouseDelay(500);
await robot.moveMouseSmooth(x, y);
await robot.moveMouse(x, y);
}
function handleOffscreenMouseMovement(pos) {
deltaX += pos.x - 500;
deltaY += pos.y - 500;
server.send(otherScreenId, 'coord', { x: deltaX, y: deltaY });
robot.moveMouse(500, 500);
const isLeft = otherScreenLeft && deltaX < otherScreenLeft.left && deltaY >= otherScreenLeft.top
&& deltaY <= otherScreenLeft.bottom;
const newMode = isLeft ? MODES.ONSCREEN : MODES.OFFSCREEN;
if (mode !== newMode && newMode === MODES.ONSCREEN) {
mode = newMode;
setupOnScreen({ isLeft, pos });
}
}
function mac_moveMouse(dx, dy) {
var mouse_pos = robot.getMousePos();
robot.moveMouse(mouse_pos.x + dx, mouse_pos.y + dy);
}
function SetFlasksAreaPosition(Position) {
var positionX = Inventory.getIndex();
var basePositionX = Window.width * 0.775;
var basePositionY = Window.height * 0.478;
robot.moveMouse(basePositionX + positionX * Inventory.ITEM_SQUARE_ICR, basePositionY);
}
function move(cb) {
var R;
var aspectFix;
if (globalMoveRadius === null) {
R = Window.height * 0.0908;
aspectFix = 1;
} else {
R = globalMoveRadius;
aspectFix = Window.aspect;
}
robot.moveMouse(Window.basePosition.x + R * Math.cos(globalMoveAngle) * aspectFix, Window.basePosition.y + R * Math.sin(globalMoveAngle));
if(typeof cb === "function") {
cb();
}
}
robot.moveMouse(pos.x - mouse_step, pos.y)
break;
case '🔴':
robot.mouseClick()
break;
case '➡️':
robot.moveMouse(pos.x + mouse_step, pos.y)
break;
case '↙️':
robot.moveMouse(pos.x - mouse_step, pos.y + mouse_step)
break;
case '⬇️':
robot.moveMouse(pos.x, pos.y + mouse_step)
break;
case '↘️':
robot.moveMouse(pos.x + mouse_step, pos.y + mouse_step)
break;
case 'Bigger steps':
mouse_step = mouse_step + 3
break;
case 'Smaller steps':
mouse_step = mouse_step - 3
break;
case '📸':
child_process.exec('screencapture -C -t jpg -r ./monitor.jpg', () => {
bot.sendPhoto(msg.chat.id, 'monitor.jpg', { caption: '🖥' })
})
break;
}
})
function SetStashAreaPosition(Position) {
var positionX = (Inventory.getIndex() % 12);
var positionY = parseInt(Inventory.getIndex() / 12);
var basePositionX = Window.width * 0.032;
var basePositionY = Window.height * 0.190;
robot.moveMouse(basePositionX + positionX * Inventory.ITEM_SQUARE_ICR, basePositionY + positionY * Inventory.ITEM_SQUARE_ICR);
}
await this.app.browserWindow.getBounds().then(async (bounds) => {
await robot.setMouseDelay(100);
let x = bounds.x + 95;
let y = bounds.y + 35;
await robot.moveMouseSmooth(x, y);
await robot.moveMouse(x, y);
await robot.mouseClick();
await webAction.openApplicationMenuByClick();
await robot.setKeyboardDelay(1000);
await robot.keyTap('enter');
await robot.keyTap('down');
await robot.keyTap('down');
await robot.keyTap('right');
for (let i = 0; i < 6; i++) {
await robot.keyTap('down');
}
await robot.keyTap('enter');
});
}
this.HubConnection.on("MouseDown", (button, percentX, percentY, requesterID) => {
if (RCClient_1.RCClient.Mode == "Normal" && NormalPage_1.ViewOnlyToggle.checked) {
return;
}
var viewer = RCClient_1.RCClient.ViewerList.find(x => x.ViewerConnectionID == requesterID);
if (viewer) {
var absolutePoint = Utilities_1.GetAbsolutePointFromPercents(percentX, percentY, viewer);
Robot.moveMouse(absolutePoint.x, absolutePoint.y);
Robot.mouseToggle("down", button);
}
});
this.HubConnection.on("MouseUp", (button, percentX, percentY, requesterID) => {