[gfx] incomplete silverlight mouse events fix ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[gfx] incomplete silverlight mouse events fix ?

Patrick Ruzand
Hi,

While debugging a mouse event issue I have with the silverlight
renderer, I notice that the mouse event conversion might be
incomplete, in particular when a bubbling is occuring.

In gfx, from what I have seen, the silverlight->gfx event conversion
is done in the mouseFix() function :

        var mouseFix = function(s, a){
                var ev = {target: s, currentTarget: s,
                        preventDefault: function(){}, stopPropagation: function(){}};
                if(a){
                        try{
[...]

Re: ev.currentTarget:
The silverlight doc says that the first parameter ('sender') received
by an event handler is the object on which the handler has been
attached to. (http://bit.ly/9HuO8a)
As I understand it, it matches the definition of the HTML DOM
event.currentTarget property (the element whose event listeners
triggered the event).
So mouseFix is right when setting evt.currentTarget to s.

re: ev.target:
mouseFix initializes ev.target to the sender value too. I think this
is wrong in the case of an input event in Silverlight 2+.
Indeed, in the HTML DOM event api, target is the element that
triggered the event.
In Silverlight 2+ API, it translates into the
Mouse[Button]EventArgs.Source property, which "Reports the object that
raised the event."
(http://msdn.microsoft.com/en-us/library/cc972651(VS.95).aspx and
http://msdn.microsoft.com/en-us/library/bb979694(VS.95).aspx)

So, I would say that in case of Silverlight 2+,  ev.target should be
initialized to the value of  args.source instead of the sender.
The "problem" is that the source property only appears with
Silverlight 2, I guess it requires a specific check (not sure how you
deal with such version issue).

Anyway, am I missing something or is there something wrong in mousefix()  ?

thx
--
Patrick
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
[hidden email]
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: [gfx] incomplete silverlight mouse events fix ?

Eugene Lazutkin
Most probably you are right. dojox.gfx' Silverlight renderer was written
targeting Silverlight 1.0. Obviously it doesn't include optimizations,
or enhancements available in later versions.

Please open an enhancement ticket and attach a patch to it.

Cheers,

Eugene Lazutkin
Dojo Toolkit, Committer
http://lazutkin.com/

On 11/03/2010 07:47 AM, Patrick Ruzand wrote:

> Hi,
>
> While debugging a mouse event issue I have with the silverlight
> renderer, I notice that the mouse event conversion might be
> incomplete, in particular when a bubbling is occuring.
>
> In gfx, from what I have seen, the silverlight->gfx event conversion
> is done in the mouseFix() function :
>
> var mouseFix = function(s, a){
> var ev = {target: s, currentTarget: s,
> preventDefault: function(){}, stopPropagation: function(){}};
> if(a){
> try{
> [...]
>
> Re: ev.currentTarget:
> The silverlight doc says that the first parameter ('sender') received
> by an event handler is the object on which the handler has been
> attached to. (http://bit.ly/9HuO8a)
> As I understand it, it matches the definition of the HTML DOM
> event.currentTarget property (the element whose event listeners
> triggered the event).
> So mouseFix is right when setting evt.currentTarget to s.
>
> re: ev.target:
> mouseFix initializes ev.target to the sender value too. I think this
> is wrong in the case of an input event in Silverlight 2+.
> Indeed, in the HTML DOM event api, target is the element that
> triggered the event.
> In Silverlight 2+ API, it translates into the
> Mouse[Button]EventArgs.Source property, which "Reports the object that
> raised the event."
> (http://msdn.microsoft.com/en-us/library/cc972651(VS.95).aspx and
> http://msdn.microsoft.com/en-us/library/bb979694(VS.95).aspx)
>
> So, I would say that in case of Silverlight 2+,  ev.target should be
> initialized to the value of  args.source instead of the sender.
> The "problem" is that the source property only appears with
> Silverlight 2, I guess it requires a specific check (not sure how you
> deal with such version issue).
>
> Anyway, am I missing something or is there something wrong in mousefix()  ?
>
> thx
> --
> Patrick
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://docs.dojocampus.org
> [hidden email]
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
[hidden email]
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest