LeprovostQuentin / mt4j

Automatically exported from code.google.com/p/mt4j
GNU General Public License v2.0
0 stars 0 forks source link

Weird comportment when a MTComponent has no registered input processor #18

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
MTRectangle a = new MTRectangle(150,100,0,40,40,mtApplication);
getCanvas().addChild(a);
MTRectangle b = new MTRectangle(100,150,0,40,40,mtApplication);
b.unregisterAllInputProcessors();
a.addChild(b);
MTRectangle c = new MTRectangle(200,150,0,40,40,mtApplication);
c.unregisterAllInputProcessors();
c.registerInputProcessor(new TapProcessor(mtApplication));
a.addChild(c);

What is the expected output? What do you see instead?
I would assume that b and c should have the same comportment, but they don't. 
Dragging c does nothing (as expected), but dragging b drags a (and therefore 
all 3 squares).

What version of the product are you using? On what operating system?
last from repository

Please provide any additional information below.
It may not be a bug, and anyway it is not that big of a deal, but I just wanted 
to point it out.

Original issue reported on code.google.com by mattsl...@gmail.com on 19 Oct 2010 at 1:06

GoogleCodeExporter commented 8 years ago
I guess you are working with the latest SVN version because this behaviour is a 
result of the possibility to let input events bubble up the component hierarchy 
which was recently added.
So what happens is that when no input processor is registered with a component 
the default behaviour is to bubble the events up to its parent which is why you 
drag "a" when dragging "b".
The default behaviour of each input processor is to stop the input event 
propagation unless stated otherwise (e.g. 
tapProcesssor.setStopPropagation(boolean)).

So to get the behaviour that you expected in your Issue you could do this:
b.addInputListener(new IMTInputEventListener() {
            public boolean processInputEvent(MTInputEvent inEvt) {
                inEvt.stopPropagation();
                return false;
            }
        });

This input bubbling was recently added and im still open for 
comments/suggestions. But this should explain the behaviour you are getting.

Original comment by sirhc.f...@gmail.com on 16 Nov 2010 at 5:03

GoogleCodeExporter commented 8 years ago

Original comment by sirhc.f...@gmail.com on 11 Feb 2011 at 10:25