transparencyint / CGIP

Climate Governance Integrity Program
6 stars 1 forks source link

Add touch support #175

Closed mrflix closed 11 years ago

mrflix commented 11 years ago

I started f-touch-support

Feel free to test it and add todos.

Changes

Detect Touch

We use Modernizr to find out what capabilities the browser has. It creates a boolean indicating whether the browser supports touch or not:

Modernizr.touch -> true or false

Events

For touch support we have to work with different events:

mousedown -> touchstart mousemove -> touchmove mouseup -> touchend

this.inputDownEvent, this.inputMoveEvent and this.inputUpEvent store the relevant event name and can be accessed in every view.

Position

We can't use event.pageX/Y on mobile, because the mobile event can hold more than one finger:

event.pageX -> this.normalizedX(event) event.pageY -> this.normalizedY(event)

this.normalizedX/Y(event) returns – depending on the device – either the mouse position or the position of the first finger.

Also a event.preventDefault is important for all touch events to prevent the normal behaviour of a touch which is scrolling.

janmonschke commented 11 years ago

Cannot compile it: error: { [Error: Cannot find module 'nib'] code: 'MODULE_NOT_FOUND' }

Which version of stylus-brunch do you have installed? Maybe we need to update it.

mrflix commented 11 years ago

I've got stylus-brunch 1.4.2 running.

mrflix commented 11 years ago

For removing the click delay, fastclick sounds promising. Jan where is the best place to initialize it?

janmonschke commented 11 years ago

initialize.js is da place!

Removed and re-added all modules, compiled now ;)

Tried it out on my Playbook and works just fine. (Although it just crashed the browser for no reason) ;)

On Thu, Jan 17, 2013 at 4:49 PM, Felix Niklas notifications@github.comwrote:

For removing the click delay, fastclickhttps://github.com/ftlabs/fastclicksounds promising. Jan where is the best place to initialize https://github.com/ftlabs/fastclick#usage it?

— Reply to this email directly or view it on GitHubhttps://github.com/transparencyint/CGIP/issues/175#issuecomment-12373565.

janmonschke commented 11 years ago

One thing I noticed: On the desktop version the gridLines are shown all the time. (But I think that's not related to your changes and was a bug somewhere deep, could not reproduce it)

janmonschke commented 11 years ago

Github Task Lists :heart: