touchscreen

Getting the coordinates from the location I touch the touchscreen

£可爱£侵袭症+ 提交于 2019-11-26 16:23:14
问题 I try to get the coordinates from the location where I hit the touchscreen to do put a specific UIImage at this point. How can I do this? 回答1: In a UIResponder subclass, such as UIView : override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { let touch = touches.anyObject()! as UITouch let location = touch.locationInView(self) } This will return a CGPoint in view coordinates. Updated with Swift 3 syntax override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { let

JavaScript mapping touch events to mouse events

安稳与你 提交于 2019-11-26 14:12:49
I'm using the YUI slider that operates with mouse move events. I want to make it respond to touchmove events (iPhone and Android). How can I produce a mouse move event when a touchmove event occurs? I'm hoping that just by adding some script at the top that touchmove events will get mapped to the mouse move events and I won't have to change anything with the slider. Mickey Shine I am sure this is what you want: function touchHandler(event) { var touches = event.changedTouches, first = touches[0], type = ""; switch(event.type) { case "touchstart": type = "mousedown"; break; case "touchmove":

How can I make a jQuery UI 'draggable()' div draggable for touchscreen?

旧巷老猫 提交于 2019-11-26 12:17:47
问题 I have a jQuery UI draggable() that works in Firefox and Chrome. The user interface concept is basically click to create a \"post-it\" type item. Basically, I click or tap on div#everything (100% high and wide) that listens for clicks, and an input textarea displays. You add text, and then when you\'re done it saves it. You can drag this element around. That is working on normal browsers, but on an iPad I can test with I can\'t drag the items around. If I touch to select (it then dims

Get the co-ordinates of a touch event on Android

不打扰是莪最后的温柔 提交于 2019-11-26 11:02:21
问题 I\'m new to Android, I\'ve followed the hello world tutorial through and have a basic idea of what\'s going on. I\'m particularly interested in the touch screen of my T-Mobile Pulse so just to get me started I want to be able to write the co-ordinates of a tocuh event on the screen, so say the user touched the co-ordinate 5,2 - a textview on the screen would display that. At present I have a simple program that just loads an xml file which contains the textview I intend to write the co

How to use ADB to send touch events to device using sendevent command?

橙三吉。 提交于 2019-11-26 06:13:47
问题 I am trying to send touch events to a device using AndroidDebugBridge, so that I can do some basic automation for UI tests. I have followed the discussion in LINK. I am able to use sendevent to simulate touch on emulators, but unable to do the same on a device. Like in above link the emulator seems to send out 6 events for each touch ( xcoord, ycoord, 2 for press,2 for release) and it was easy to use this information to sendevents, but a getevent for the touchscreen for a device seems to

JavaScript mapping touch events to mouse events

ぃ、小莉子 提交于 2019-11-26 03:05:10
问题 I\'m using the YUI slider that operates with mouse move events. I want to make it respond to touchmove events (iPhone and Android). How can I produce a mouse move event when a touchmove event occurs? I\'m hoping that just by adding some script at the top that touchmove events will get mapped to the mouse move events and I won\'t have to change anything with the slider. 回答1: I am sure this is what you want: function touchHandler(event) { var touches = event.changedTouches, first = touches[0],

Detecting a long press with Android

蓝咒 提交于 2019-11-26 01:47:13
问题 I am currently using onTouchEvent(MotionEvent event){ } to detect when the user presses my glSurfaceView is there a way to detect when a long click is made. I\'m guessing if I can\'t find much in the dev docs then it will be some sort of work around method. Something like registering ACTION_DOWN and seeing how long it is before ACTION_UP. How do you detect long presses on android using opengl-es? 回答1: Try this: final GestureDetector gestureDetector = new GestureDetector(new GestureDetector