Re: Do setDragImage or addElement work?
"alta88[nntp]" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xpfe |
|---|---|
| Message-ID | <[email protected]> |
---On 2011.Sep.08 2:43 PM, Neil Deakin wrote:
> On 11-09-08 1:18 PM, alta88[nntp] wrote:
>>
>> i've tried to set a drag image according to the doc
>> https://developer.mozilla.org/En/DragDrop/Drag_Operations#dragfeedback
>>
>> as well as usage in mozilla-central codebase (all of 2), for which
>> neither the favicon drag image when dragging 1) the urlbar identity box,
>> nor 2) a tab, actually work.
>>
>> i haven't found any working example in html5, using Fx 9a, either. can
>> anyone verify if this is indeed supported, as the docs seems to
>> indicate, and if there is an example anywhere?
>
> setDragImage is implemented. The documentation example you gave should
> work ok.
>
>
i have this code, from the doc, to set an image under the cursor when
dnd on a Tb thread pane message. i've tried with a visible xul <image>
element as well. nothing shows an image.
do you have an example? xul or html, i haven't found either anywhere.
dnd on the Fx urlbar favicon doesn't show a dragged image for me, should it?
-----------
var _ThreadPaneOnDragStart = ThreadPaneOnDragStart;
ThreadPaneOnDragStart = function TM_ThreadPaneOnDragStart(aEvent) {
if (v.editingMode) {
// In edit mode, support drag and drop rethreading of messages.
...
var image =
document.createElementNS("http://www.w3.org/1999/xhtml","html:canvas");
image.width = image.height = 50;
var ctx = image.getContext("2d");
ctx.lineWidth = 4;
ctx.moveTo(0, 0);
ctx.lineTo(50, 50);
ctx.moveTo(0, 50);
ctx.lineTo(50, 0);
ctx.stroke();
var dt = aEvent.dataTransfer;
dt.setData('text/plain', 'Data to Drag');
// aEvent.dataTransfer.effectAllowed = "move";
// aEvent.dataTransfer.dropEffect = "move";
dt.setDragImage(image, 0, 0);
_u.log.debug("ThreadPaneOnDragStart: image - "+ image.id);
return;
}
_ThreadPaneOnDragStart(aEvent);
}