MCPcopy Create free account
hub / github.com/apache/cloudstack / _convertButtonMask

Method _convertButtonMask

systemvm/agent/noVNC/core/rfb.js:1210–1238  ·  view source on GitHub ↗
(buttons)

Source from the content-addressed store, hash-verified

1208 }
1209
1210 static _convertButtonMask(buttons) {
1211 /* The bits in MouseEvent.buttons property correspond
1212 * to the following mouse buttons:
1213 * 0: Left
1214 * 1: Right
1215 * 2: Middle
1216 * 3: Back
1217 * 4: Forward
1218 *
1219 * These bits needs to be converted to what they are defined as
1220 * in the RFB protocol.
1221 */
1222
1223 const buttonMaskMap = {
1224 0: 1 << 0, // Left
1225 1: 1 << 2, // Right
1226 2: 1 << 1, // Middle
1227 3: 1 << 7, // Back
1228 4: 1 << 8, // Forward
1229 };
1230
1231 let bmask = 0;
1232 for (let i = 0; i < 5; i++) {
1233 if (buttons & (1 << i)) {
1234 bmask |= buttonMaskMap[i];
1235 }
1236 }
1237 return bmask;
1238 }
1239
1240 _handleMouse(ev) {
1241 /*

Callers 2

_handleMouseMethod · 0.80
_handleWheelMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected