How to use the guacamole-common-js.Mouse function in guacamole-common-js

To help you get started, we’ve selected a few guacamole-common-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / incubator-dlab / services / self-service / src / main / resources / webapp / src / app / webterminal / webterminal.component.ts View on Github external
);

    const guac = new Guacamole.Client(tunnel);
    const display = document.getElementById('display');

    display.appendChild(guac.getDisplay().getElement());
    this.layer = guac.getDisplay().getDefaultLayer();

    guac.connect(`{"host" : "${id_parameter}", "endpoint" : "${endpoint_parameter}"}`);

    // Error handler
    guac.onerror = (error) => console.log(error.message);
    window.onunload = () => guac.disconnect();

    // Mouse
    const mouse = new Guacamole.Mouse(guac.getDisplay().getElement());
    mouse.onmousemove = (mouseState) => {
      if (navigator.userAgent.indexOf('Firefox') === -1) {
        mouseState.x = mouseState.x + 125;
        mouseState.y = mouseState.y + 65;
      }
      guac.sendMouseState(mouseState);
    }

    const keyboard = new Guacamole.Keyboard(document);
    keyboard.onkeydown = (keysym) => guac.sendKeyEvent(1, keysym);
    keyboard.onkeyup = (keysym) => guac.sendKeyEvent(0, keysym);
  }
}
github paidem / guacozy / frontend / src / Components / GuacViewer / GuacViewer.js View on Github external
// somehow Right Ctrl is not sent, so send Left Ctrl instead
            if (keysym === 65508) return 65507;

            return keysym
        };

        keyboard.onkeydown = function (keysym) {
            guacRef.current.sendKeyEvent(1, fixKeys(keysym));
        };

        keyboard.onkeyup = function (keysym) {
            guacRef.current.sendKeyEvent(0, fixKeys(keysym));
        };

        // Mouse
        let mouse = new Guacamole.Mouse(displayRef.current);


        mouse.onmousemove = function (mouseState) {
            mouseState.x = mouseState.x / scale.current;
            mouseState.y = mouseState.y / scale.current;
            guacRef.current.sendMouseState(mouseState);
        };

        mouse.onmousedown = mouse.onmouseup = function (mouseState) {
            guacRef.current.sendMouseState(mouseState);
        };


    }, [controlInput]);