I just started working with Corona and love it. I’ve gotten pretty far without having to post anything, but now I’m at a point where I’m just not getting it.
Here’s the situation:
- display group with a background, and some cards on the background that are added by double tapping on this background
- The whole display group is zoomable and pannable
The problem is this:
- Getting the double tap on the background = add new card
- touch and drag on the background. Reason I’m capturing the touch on the background is because each card is also draggable. Seems if I capture the drag from the entire display group it’ll work, BUT then I can’t capture drags on any containing objects.
- Right now, double tap to do this will add the card when it’s zoomed, but the x/y is based on the coords of the background. I did some math that adds it with the offset so it’s at least RIGHT:
– from inside a listener on the bg
cardbg.x = event.x + (display.contentWidth - desktopGroup.width)
cardbg.y = event.y + (display.contentHeight - desktopGroup.height) - Problem with this is most of the time the card will be place off the zoomed view somewhere and the user won’t know about it and think it didn’t work.
What I need to do is have it only add the card under the mouse in the viewport no mater what the zoom or pan. Can somebody that’s better at math then me please tell me the magic sauce for this?
Thanks all!
P.S. Maybe there’s a better way to do this than what I have outlined? What about a hit test from the touch? [import]uid: 169520 topic_id: 29784 reply_id: 329784[/import]