bp74 / StageXL

A fast and universal 2D rendering engine for HTML5 and Dart.
http://www.stagexl.org
Other
881 stars 82 forks source link

One of the last commits break Touch events on masked clips #42

Closed Krobill closed 11 years ago

Krobill commented 11 years ago

Sorry can't be more specific than that for now. I'll try to create a repro case too.

bp74 commented 11 years ago

One of the last commits disabled mouse and touch events outside of the mask - which is the correct behavior.

Krobill commented 11 years ago

Well, it disabled touch events even inside the mask in our project ^^

bp74 commented 11 years ago

Okay that shouldn't be the case ;)

bp74 commented 11 years ago

What kind of mask do you use? rectangle, circle, custom or shape?

Krobill commented 11 years ago

A shape directly on the same timeline as the masked clip. The whole thing is in a clip exported by dartToolkit and added to the stage by code.

bp74 commented 11 years ago

Hmmmm maybe because the mask has an outline but is not filled. The hitTest on Shapes can only work correct if the inside of the mask is filled with a color. I know this is strange but i have no idea how to solve it in another way.

bp74 commented 11 years ago

Well i have an idea how to solve it in another way, but i don't like it very much. But obviously this is a problem so i will think about it a little more.

Krobill commented 11 years ago

Our mask is a filled shape (without any outline). Well, to be really precise, it's a filled shaped but in the FLA file we use the option display as outline to see what's under it. Any chance the JSFL of dartToolkit believes it's a stroke instead of a fill just because of this option ? That would be pretty stupid...

bp74 commented 11 years ago

I don't know. But either way this is a problem because uses don't expect this behavior. I think i can make the hitTest more compatible with the clipping of the mask. But this needs some testing so i can't change the code right away. Give me a day or two to fix this. For now, you could do this to get the old behavior back:

Search the Mask.dart file. Remove the code from the function "hitTest" in line 174 and always return true;

Now you will get mouse/touch events outside of the mask, but that was the same a few days before.

Krobill commented 11 years ago

For the end of our current project I rolled back to a 23 sept. commit because, we have this problem and the thing with the autosize of TextField which doesn't work as it used to be. I'm under a bit of pressure to finish this right now but I'll use the finished project to help you track any bug that you have not resolved at this point.

bp74 commented 11 years ago

I have changed the code, it should work correct now. Please give it a try!

Krobill commented 11 years ago

Nope sorry. Still broken on our app. I'll try to create an example a bit later, probably this week end.

bp74 commented 11 years ago

I thought about it and maybe your application relies on the old behavior that you get mouse events outside of the mask (which is not desired). You could solve this in different ways, but one option is to use the GlassPlate display object which is an invisible display object with a rectangular shape. The GlassPlate itself is invisible but it get's all the mouse and touch events. Just add the GlassPlate on top of your current display objects.

Krobill commented 11 years ago

Nope our application relies on the masked clip being clickable only within the mask. Sorry, did not have the time this week end to extract a simple example from our complete application. I'll try to have this done by one of my colleague tomorrow.

Krobill commented 11 years ago

Test sample sent by mail !

bp74 commented 11 years ago

Thanks a lot! I was able to find the problem and it works now. Please give it a try.

Krobill commented 11 years ago

Seems to be working! That's great news. It seems we can once again use the latest version for our projects! :smile:

bp74 commented 11 years ago

Great! I think i will publish the current version as StageXL 0.8.6 this weekend. Most of the new bugs should be fixed now :)