Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click events for Ti.Draggable not firing? #3

Open
dirkesquire opened this issue Dec 23, 2012 · 4 comments
Open

Click events for Ti.Draggable not firing? #3

dirkesquire opened this issue Dec 23, 2012 · 4 comments

Comments

@dirkesquire
Copy link

I have a screen with two boxes in Titanium. I am using the Ti.Draggable module to allow the box to be dragged around the screen. I create my draggable objects with drag.createView() and I know that I can add an event listener for the 'start' and 'end' events for when dragging starts and stops. However the normal click and dblclick events seem to not be working anymore.
In the example below I have two boxes: A green box and a blue box.This demo shows how the green box responds normally to click and dblclick events. The blue box does not. However the blue box does support dragging.
Question: How do I listen to a click event on the blue box?

var self = Ti.UI.createView();
var drag = require('ti.draggable');

var greenbox = Ti.UI.createView({
    top: 50,
    left: 0,
    width: 100,
    height: 100,
    backgroundColor:'#99FF66'
});
self.add(greenbox);

var bluebox = drag.createView({
    top: 50,
    left: 110,
    width: 100,
    height: 100,
    backgroundColor:'#66CCFF'
});
self.add(bluebox);

greenbox.addEventListener('click', function(e) {
    alert('click');
});

greenbox.addEventListener('dblclick', function(e) {
    alert('dbl click');
});

bluebox.addEventListener('click', function(e) {
    alert('click');
});

bluebox.addEventListener('dblclick', function(e) {
    alert('dbl click');
});

return self;
@dirkesquire
Copy link
Author

Update: I notice that it seems to be working fine in iOS so it is just in Android that the click events are not firing.

@vpsouza
Copy link

vpsouza commented May 11, 2013

So, i need to solve this issue too. For Android, other events else touch start or move not fringed.

@bitfabrikken
Copy link

I think this is a general Android Titanium issue, a bug that's been existing for years now. When you modify the transform of something that has e.g. a click eventlistener attached, the eventlistener doesn't move with it.

For instance, create a square view, add a click eventlistener to it, then modify its transform by scaling it up 100%. The view will only react to clicks on the original, untransformed area. This also happens with translate and rotate. Very frustrating issue, and Appcelerator doesn't seem to want to fix it, as it's been marked "high" in JIRA for years. The ticket is here: https://jira.appcelerator.org/browse/TIMOB-6304

@vpsouza
Copy link

vpsouza commented May 14, 2013

it's strange... draggable views can listen to longpress events... but when i make a simple click, it does a longpress and a start was throwed too. i think there's a bug of Draggable...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants