drag and drop for kfm

I had a bit of fun today. I finished off the list of outstanding bugs in KFM’s bug-tracker, and added the ability to move files around the directories by dragging them.

To select multiple files, you click one file, then click others with the CTRL key pressed down.

demo (click the Image icon on the second row, then click Browse Server)

Once I had the drag’n’drop coded, I realised that there was no real indication to the user of what had just happened (files just vanished, with no real explanation of why), so I added a visible indication – what I call “boxdrop tracers”; when you do the drag and release, pseudo icons appear where the selected files where, and move to the drop location (the directory you’re dropping the files into), helping the user to visualise that files have “moved” into the directories, instead of just vanishing.

I have two Firefox questions, which maybe some JavaScript guru type can answer. No rush, as I don’t actually /need/ to know, but:

If I click on an element, triggering an onclick event, which sets off a setTimeout which calls a function, is there a way for that function to know that I have the CTRL key pressed down? After all, the way everyone seems to do it is to check e.ctrlKey, where e is the event which triggered the function call – but in this case, the function is called by a setTimeout, not a trigger. Any way to check?

Another question which can possibly be answered: When a mouse is in “drag” mode (ie; the mouse button is clicked while the mouse is moving), no onmouseover or onmouseout events seem to be triggered on any elements – is this a bug in Firefox?

Today’s work can be downloaded here.

Comments are closed.

%d bloggers like this: