Giter VIP home page Giter VIP logo

mmiscool / js-virtual-touchpad Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 17 KB

Fake touchpad overlay for mobile sites that carries out expected mouse and pointer events. Kind of hacky method to make a desktop application work on mobile. Link to JSketcher application with fake mouse overlay demo. Demo only works on touchscreen devices.

Home Page: https://maker.cloud/jsketcher/mouse.html

License: MIT License

JavaScript 74.14% HTML 25.86%
desktop dom-events dom-manipulation events javascript mobile mouse

js-virtual-touchpad's Introduction

JS-virtual-Touchpad

Its like having a mouse in your mobile browser.

Basic functionality

This project provides a basic emulation of a laptop touchpad that can be overlayed over an application designed for desktop use. The touchpad shows up as a mostly transparent overlay over your web application.

Usage instructions

To use copy the "mouse.html" file and "mouse" folder to the same directory hosting your web application.

In your web application add the following line to the index.html file.

<script src="./mouse/checkIfMobile.js"></script>

Now visit your application from a mobile browser.

If you want to test on a desktop type device you will have togo to the /mouse.html file directly as it will not automatically redirect to use the virtual touchpad unless it detects you are on a mobile device.

troubleshooting

On some sites setting the page to full screen will not work correctly. If you run in to an issue with the iframe contents not showing up correctly comment out the following line in ./mouse/mouseController.js

if (window.innerHeight !== screen.height) document.body.requestFullscreen();

In-depth explanation of how it works

See article: https://medium.com/@admin_11488/bridging-the-gap-making-a-desktop-web-app-mobile-friendly-with-a-virtual-mouse-touchpad-e37b69835a9f

Reason this thing exists

JSketcher is a browser based CAD modeler. I wanted to make it work better on mobile for actually creating models. Not Just viewing. After making this code work in JSKetcher with a few customizations specific to JSketcher I extracted the code and cleaned it up to work more generically. JSketcher project is located here. https://github.com/xibyte/jsketcher

js-virtual-touchpad's People

Contributors

mmiscool avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

js-virtual-touchpad's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.