touch-event

Modernizr.touch returns true on firefox browser

陌路散爱 提交于 2019-12-05 02:29:17
I have written a peace of code to get the event based on touch and non-touch. Its working all other browsers and devices, but Firefox. Default FF return the true . var thumbsEvent, isTouch = Modernizr.touch; // detect the touch if(isTouch){ thumbsEvent = 'click';//on touch surface, click } else { thumbsEvent = 'mouseover';//on non touch surface, mouseover } Is there a way to manage this issue. Example fiddle On behalf of Modernizr - We're really sorry about this. Modernizr.touch has been renamed Modernizr.touchevents in the yet-to-be-released version 3.0, as it is a far more accurate

Detecting taps on attributed text in a UITextView while the keyboard is showing

拟墨画扇 提交于 2019-12-04 23:01:21
问题 This is a supplemental question to a previous answer of mine to the question Detecting taps on attributed text in a UITextView in iOS. I retested the following code with Xcode 7.1.1 and iOS 9.1 and it works fine with the setup described in the answer I linked to. import UIKit class ViewController: UIViewController, UIGestureRecognizerDelegate { @IBOutlet weak var textView: UITextView! override func viewDidLoad() { super.viewDidLoad() // Create an attributed string let myString =

android graphview getting touch location

吃可爱长大的小学妹 提交于 2019-12-04 21:37:57
First off I am using this library in my app http://www.jjoe64.com/p/graphview-library.html to create the graphs. I then use this code (which I found in the comments) to get the x location of the touch event. //intercepts touch events on the graphview @Override public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { //when you touch the screen case MotionEvent.ACTION_DOWN: // gets the location of the touch on the graphview float x = event.getX(event.getActionIndex()); // gets the boundries of what you are viewing from the function you just added // vp is set to vp[0]

Multitouch touchEvents not triggered as they should on Safari Mobile

自作多情 提交于 2019-12-04 17:14:20
I have various touchEvents detection on a page on Safari Mobile (a controller, if you want to know...). They all work well indepedantly, but whenever I have a first touchpoint pressed, If I touch a new point, the events are triggered when I trigger a new one. For example : I hold the stick with a finger. It's not moving I press a button, a touchStart event should be triggered but is not If I move the stick, the touchStart event is triggered If I let go of the button, the touchStart is triggered, but not the touchEnd If I move the stick (touchMove), the touchEnd is triggered You understand how

ontouchevent gesture scrolling issues

匆匆过客 提交于 2019-12-04 15:31:01
I'm using the following Javascript to create ontouchstart/move/end callbacks on div elements for an iOS web app. The only problem at the moment is that when you try to scroll up and down the page, it triggers the ontouchstart element and changes the CSS of the div. I want the CSS of the div to change only when a user selects the item. I'm fairly basic with Javascript but if anyone knows any way of getting the Javascript to only trigger when a user is selecting an item it would be greatly appreciated! Thanks! TC Javascript: function onclickCallback( event ) { } function ontouchstartCallback(

touchend handler fires twice

随声附和 提交于 2019-12-04 12:03:59
On a webapp on iOS, I have a bunch of buttons that respond only to touchend (as a shortcut to the click delay in mobile safari). When I stick an alert in the handler, then a subsequent tap of any other button on the page fires this original handler even though they have their own handlers. Here's some sample code that illustrates the problem: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style"

Simulating Touch Screen Events on Android

不羁岁月 提交于 2019-12-04 09:49:37
Is it possible for a background process or softkeyboard to create touch events and send them to screen as if the screen was actually touched? i.e. simulating touch screen events. There is a tool that comes with the SDK called Monkey which generates pseudo-random streams of user events such as: clicks touches gestures a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner. There is also the monkeyrunner tool which provides an API for writing programs that control an Android device or emulator from outside of

drag and drop in android 3.x causes illegalStateException after small number on drags

微笑、不失礼 提交于 2019-12-04 09:10:28
问题 there's a problem with drag and drop mechanism at android 3.x : after doing some drags (say 30 drags) an exception accrues (see the attached link) https://groups.google.com/forum/#!msg/android-platform/2APvO248NNY/rKI-5dCT8XcJ (I'm getting in log the same thing as attached to that post..) android technician answers there that it's bug in the API, and says the only way to avoid the problem is to call Garbage Collector. I did it. the exception not been thrown anymore, but after a while (say

Android MotionEvent ACTION_MOVE efficiency. How to improve performance?

佐手、 提交于 2019-12-04 07:25:17
I am currently working on an app that allows for free-drawing. The current method I am using is as follows: currentLine is a list that keeps a history of all points that ACTION_MOVE returns. public boolean onTouchEvent (MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_MOVE: Point p = new Point(event.getX(),event.getY()); currentLine.addPoint(p); invalidate(); break; } return true; } I then take these points and draw them in the onDraw method of my class. @Override protected void onDraw(Canvas c) { super.onDraw(c); //Draw Background Color c.drawColor(Color.BLUE); /

How do I get the coordinates of a map on tap with MapFragment (not MapView)?

本秂侑毒 提交于 2019-12-04 02:24:35
I have searched around on how to get the coordinates of a location when the map is tapped. However, most, if not all the examples require a MapView as a parameter. For example: public boolean onTap(GeoPoint p, MapView map){ if ( isPinch ){ return false; }else{ Log.i(TAG,"TAP!"); if ( p!=null ){ handleGeoPoint(p); return true; // We handled the tap }else{ return false; // Null GeoPoint } } } @Override public boolean onTouchEvent(MotionEvent e, MapView mapView) { int fingers = e.getPointerCount(); if( e.getAction()==MotionEvent.ACTION_DOWN ){ isPinch=false; // Touch DOWN, don't know if it's a