Actually, creating localX/localY in HTML is expensive so maybe not a PAYG 
solution.



I suggest to just have clientX/Y mirror the mouse event and let listeners 
figure out what they need similar to what I did here [1].



Thoughts?



[1] 
https://github.com/apache/royale-asjs/blob/f6733066124309c61fb054b10439cc3551ddfaed/frameworks/projects/DragDrop/src/main/royale/org/apache/royale/html/beads/SensitiveSingleSelectionDropTargetBead.as#L248



________________________________
From: Yishay Weiss <yishayj...@hotmail.com>
Sent: Thursday, December 20, 2018 3:40:18 PM
To: dev@royale.apache.org
Subject: RE: DragEvent.clientY



The only place [1] in Flex code I see a similar logic is in DragProxy, where a 
change of targets transforms the localX/Y values. But I was referring to 
clientX/Y which should not depend on the target. As I understand [2] it, is 
just the position of the pointer in the browser window.



It could be that clientX/Y isn’t necessary in DragEvent.DRAG_OVER and that we 
only need to set localX/Y. That should be enough for my purposes using 
locaToGlobal.



I’ll change it to that and let me know if you have objections.



[1] 
https://github.com/apache/flex-sdk/blob/ba414443032b49c45ff11b61db452c8a8f428bd8/frameworks/projects/framework/src/mx/managers/dragClasses/DragProxy.as#L353



[2]  https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientX



________________________________
From: Alex Harui <aha...@adobe.com.INVALID>
Sent: Wednesday, December 19, 2018 7:21:26 PM
To: dev@royale.apache.org
Subject: Re: DragEvent.clientY

I suggest looking at the Flex code.  Some of this may have been ported without 
considering whether it is truly needed or not.  The key factor to consider is 
the event target and who is consuming the event.  IIRC, in Flex, the event 
target could be something other than the source or destination component, like 
the drag indicator, drop indicator and other things, but the DragEvent 
listeners are trying to track and compute destinations.  clientX/Y generally 
maps back to localX/Y in the Flex DragEvent.  It looks like this code is always 
using stage/screen coordinates which may be more consistent than using the 
event target's clientX/Y which will change as you drag over various things on 
the way to the final drop point.

-Alex

On 12/19/18, 1:55 AM, "Yishay Weiss" <yishayj...@hotmail.com> wrote:

    Any idea what it’s used for? Is it supposed to be the same as 
MouseEvent.clientY ? If so, why do we have this sequence in 
DragEvent.createEvent() (event being MouseEvent)?

                                                                    var 
localPoint:Point = new Point(event.screenX, event.screenY);
                                                                    var 
clientPoint:Point = PointUtils.localToGlobal(localPoint, event.target);
                                                                    de.clientX 
= clientPoint.x;
                                                                    de.clientY 
= clientPoint.y;

    I’d like to use it for SensitiveSingleSelectionDropTargetBead but the 
values don’t make sense to me. I don’t see it being used anywhere in the 
framework right now.


Reply via email to