touch
manually trigger touch event
According to W3C var e = document.createEvent(‘TouchEvent’); Then, also change e.initMouseEvent(); to e.initTouchEvent(); As you’ve created a touchstart event. The W3C link says: Some user agents implement an initTouchEvent method as part of the TouchEvent interface. When this method is available, scripts can use it to initialize the properties of a TouchEvent object, including its … Read more
Show touch keyboard (TabTip.exe) in Windows 10 Anniversary edition
OK, I reverse engineered what explorer does when the user presses that button in the system tray. Basically it creates an instance of an undocumented interface ITipInvocation and calls its Toggle(HWND) method, passing desktop window as an argument. As the name suggests, the method either shows or hides the keyboard depending on its current state. … Read more
How to set electron UserAgent
Just use an option object when loading the URL. function createWindow () { win = new BrowserWindow({width: 800, height: 600}); win.loadURL(‘http://www.whoishostingthis.com/tools/user-agent/’, {userAgent: ‘Chrome’}); win.on(‘closed’, () => { win = null }); }
Fix CSS hover on iPhone/iPad/iPod
Add onclick=”” to anything you wish iOS to recognise as an element with a hover. <div onclick=””>Click Me!</div>
Prevent that a fixed element resizes when zooming on touchscreen
Demo to this answer Dialog widget library I wrote based on this answer. Demo for the dialog widget Try it on mobile, zoom around and tap the link. While the gesture event seems to hold some metadata about the scale factor of something, we might be better off in control and find it manually. Since … Read more
How to identify if a mouseover event object came from a touchscreen touch?
Given the complexity of the issue, I thought it was worth detailing the issues and edge cases involved in any potential solution. The issues: 1 – Different implementations of touch events across devices and browsers. What works for some will definitely not work for others. You only need to glance at those patrickhlauke resources to … Read more
UIButton TouchUpInside Touch Location
UITouch *theTouch = [touches anyObject]; CGPoint where = [theTouch locationInView:self]; NSLog(@” touch at (%3.2f, %3.2f)”, where.x, where.y); That’s the right idea, except that this code is probably inside an action in your view controller, right? If so, then self refers to the view controller and not the button. You should be passing a pointer to … Read more
Injecting Touch events to another app on Android
HOW TO HANDLE CONTROLLER ACTION [ALSO API 16+] At the system level, Android reports input event codes from game controllers as Android key codes and axis values. In your game, you can receive these codes and values and convert them to specific in-game actions. When players physically connect or wirelessly pair a game controller to … Read more