0

I realize there are already a couple posts on this ( but neither this one or this one have been answered ) so I'd like to ask/articulate the issue here.

I'm developing a node webkit application ( "nw": "^0.12.3" ) and having issues enabling touch events. The following code works in Chrome/Chromium but not in node webkit:

document.body.addEventListener('touchstart', function(e){
    alert(e.changedTouches[0].pageX);
}, false);

i've enabled specific flags in nw before by adding "chromium-args" to my package.json ( using this reference ), I've tried doing the same in this instance ( see below ) but nothing seems to work...

"window": {
    "toolbar": true,
    "frame": true,
    "icon": "icon.png",
    "show_in_taskbar": false,
    "chromium-args" : {
        "--enable-touch-events" : true,
        "--enable-pinch" : true,
        "--enable-touch-drag-drop" : true,
        "--touch-events" : true,
        "--enable-touch-drag-drop" : true,
        "--ash-touch-hud" : true
    }
}

also ( for what it's worth )

var nw = require('nw.gui');
nw.Screen.Init();
nw.Screen.screens[0].touchSupport; // returns 0
//...even though the monitor is a touchscreen ( Dell XPS )
Community
  • 1
  • 1
Nick Briz
  • 1,917
  • 3
  • 20
  • 34

1 Answers1

0

Property chromium-args is in wrong place and it has wrong format.

{
  "name": "Test aoo",
  "version": "0.0.0",
  "main": "index.html",
  "window": {
    "frame": false,
    "toolbar": false
  },
  "chromium-args": "--touch-events --enable-touch-drag-drop",
}

Test it with:

 console.log('ontouchstart' in window);
DinkoM
  • 371
  • 2
  • 8
  • i was under the impression both formats work, but either way i've tried this method ( as it was suggested in one of the other two stack posts i referenced above ) sadly, it doesn't work for me. have you tried this yourself? if so ( and if it worked ) could you tell me which version of node-webkit you used? and what kind of device you used it on? – Nick Briz Nov 23 '15 at 14:29
  • I am using nw-v0.12.3. I am using http://www.alibaba.com/product-detail/low-cost-22-lcd-usb-touch_60277186843.html but also tested on laptop with touch screen. – DinkoM Nov 24 '15 at 14:42
  • i'm on linux ( Ubuntu 14.04 ) on a Dell XPS http://www.dell.com/us/business/p/xps-13-linux/pd?oc=cax13ubuntus5122v&model_id=xps-13-linux&l=en&s=bsd >> what laptop/os are you using? – Nick Briz Nov 24 '15 at 14:50
  • I'm using ubuntu 14.04/fedora. Laptop is Asus ZenBook. – DinkoM Nov 28 '15 at 16:54