Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

are Group Objects "hit testable"?
Started by Rozek Feb 10 2010 01:30 AM

- - - - -
5 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Rozek

[GLOBAL: userInfoPane.html]
Rozek
  • Contributor

  • 124 posts
  • Guests

Hello!

I have a group which contains lots of inner display objects with gaps between them (because those objects have different sizes)

Now, I would like to drag the group as a whole.

If I touch any of the objects, everything works fine - but as soon as I touch a gap, the group does no longer get the touch event (unless I enter one of the inner objects while dragging)

I already tried to set "isHitTestable" to true, but that did not work.

Is there any other trick?

Thanks in advance for any help!

Andreas Rozek
uid: 4331 topic_id: 485 reply_id: 300485


[TOPIC: post.html]
#2

wsterdan

[GLOBAL: userInfoPane.html]
wsterdan
  • Enthusiast

  • 36 posts
  • Corona SDK

Hopefully the Corona crew will have a better answer, but I had a similar problem and my workaround was to add a large rectangle to the group with the opacity set to .01 (making it invisible on my iTouch).

-- Walt Sterdan
uid: 4329 topic_id: 485 reply_id: 939


[TOPIC: post.html]
#3

carlos m. icaza

[GLOBAL: userInfoPane.html]
carlos m. icaza
  • Corona Geek

  • 2,992 posts
  • Alumni

I was just going to say "add a rectangle and make it transparent).... Walt beat me to it.

Otherwise, I would say, see if the event.x and event.y are inside of the group rectangle and if it is, then move the group.

C.
uid: 24 topic_id: 485 reply_id: 940


[TOPIC: post.html]
#4

Rozek

[GLOBAL: userInfoPane.html]
Rozek
  • Contributor

  • 124 posts
  • Guests

Walt and Carlos,

thanks for your answers - that would have been my workaround as well.

Walt: you set the opacity to 0.01 rather than 0? Will completely transparent objects miss events as well?

Thanks for your ideas!

Andreas Rozek
uid: 4331 topic_id: 485 reply_id: 942


[TOPIC: post.html]
#5

wsterdan

[GLOBAL: userInfoPane.html]
wsterdan
  • Enthusiast

  • 36 posts
  • Corona SDK

Hi Andreas;

If I remember correctly, when I set the rectangle's alpha to 0.0 it was no longer selectable; I tried a few low numbers and setting the alpha to 0.01 worked the best for me, though I didn't test too extensively.

-- Walt Sterdan
uid: 4329 topic_id: 485 reply_id: 943


[TOPIC: post.html]
#6

Rozek

[GLOBAL: userInfoPane.html]
Rozek
  • Contributor

  • 124 posts
  • Guests

Hi Walt,

that would fit to the description of ".isHitTestable" - although I thought that property would only become relevant when ".isVisible == false".

Kind regards,

Andreas Rozek
uid: 4331 topic_id: 485 reply_id: 944



[topic_controls]
[/topic_controls]