On Tue, Mar 30, 2010 at 1:39 AM, Stef Epardaud <span dir="ltr"><<a href="mailto:stef@epardaud.net">stef@epardaud.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Mar 30, 2010 at 01:31:15AM -0700, Daniel Cheng wrote:<br>
> But then it's up to the developer to detect that the keys weren't<br>
> pressed before (implement keydown events themselves), which is less<br>
> practical.<br>
><br>
> If you're copying the behavior of file managers, isn't it simply a matter of<br>
> setting dropEffect to whatever the current state of the modifier keys are?<br>
> function dragOver(e) {<br>
</div>> Â Â if (e.ctrlKey) e.dropEffect = 'copy';<br>
> Â Â else e.dropEffect = 'move';<br>
> Â Â e.preventDefault();<br>
<div class="im">> }<br>
> I'm not sure how having separate keyboard events would help in this case,<br>
> since you can't set dropEffect directly from a keyboard event.<br>
<br>
</div>I want to do more than most file managers and let users visit<br>
subdirectories by pressing control while over them, so they can continue<br>
the drag operation inside the directory (and go deeper potentially).<br>
<br>
A separate event makes it much easier to detect the key press.<br>
<div class="im"><br>
> But if I want to be notified that an external application started a drag<br>
> in my document, where should I place the listener then? document? body<br>
> node?<br>
><br>
> If an external application initiates a drag in your DOM page via the<br>
> appropriate method for your platform, it should be the same as if a user<br>
> initiated it. The dragstart event / drag events should end up getting fired<br>
> at whatever node the application initiated the drag on. Maybe I'm<br>
> misunderstanding your question though...<br>
<br>
</div>No I mean, when an external application initiates a drag and then enters<br>
my browser window/document to look for potential places where it could<br>
drop it. I want to detect that and highlight all drop targets in the<br>
page. I would do this in the "drag" or "dragstart" events if this was<br>
started in the document, but how to do it when it is started by an<br>
external application?<br></blockquote><div><br></div><div>I'd probably use a dragenter listener on the body of the document.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888">--<br>
Stéphane Epardaud<br>
</font></blockquote></div><br>