Opened 13 years ago

Closed 12 years ago

#1840 closed defect (fixed)

[patch] [CLA needed] HTMLDragAndDrop does not set size of cloned element

Reported by: guest Owned by: psowden
Priority: high Milestone: 0.9
Component: DnD Version: 0.4
Keywords: Cc:
Blocked By: Blocking:

Description

When createDragNode is called, the dragSource is cloned. However, if the dragSource does not have a specified width, then the width of the cloned element is not set.

A simple patch: diff -r -U4 dojo-0.4.0/src/dnd/HtmlDragAndDrop.js dojo/src/dnd/HtmlDragAndDrop.js --- dojo-0.4.0/src/dnd/HtmlDragAndDrop.js 2006-10-23 23:26:36.000000000 -0600 +++ dojo/src/dnd/HtmlDragAndDrop.js 2006-11-06 19:19:48.000000000 -0700 @@ -109,8 +109,13 @@

createDragNode: function() {

var node = this.domNode.cloneNode(true); if(this.dragClass) { dojo.html.addClass(node, this.dragClass); } if(this.opacity < 1) { dojo.html.setOpacity(node, this.opacity); }

+ if(node.style.width == ) + { + node.style.width = this.domNode.offsetWidth + 'px'; + node.style.height = this.domNode.offsetHeight + 'px'; + }

if(node.tagName.toLowerCase() == "tr"){

dojo.debug("Dragging table row") Create a table for the cloned row var doc = this.domNode.ownerDocument;

Attachments (1)

DNDSizing.diff (786 bytes) - added by guest 13 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 13 years ago by guest

It appears that it didn't like formatting my patch. I'll attach a diff file.

Changed 13 years ago by guest

Attachment: DNDSizing.diff added

comment:2 Changed 13 years ago by bill

Summary: HTMLDragAndDrop does not set size of cloned element[patch] [CLA needed] HTMLDragAndDrop does not set size of cloned element

Who wrote this bug report? Have you filed a CLA? www.dojotoolkit.org/icla.txt.

Also, I don't understand the manifestation of this bug. Does the drag clone appear as a different width than the original object? Can you give a simple test case? Also, what about height?

comment:3 Changed 13 years ago by guest

I have not filed a CLA, but I'm willing to, especially if it can be done electronically (I didn't see any way to do that besides fax in your link). If necessary I'll do it through mail.

my email is john dot lesueur at gmail dot com

The drag clone does appear as a different width than the original. for a simple test case:

<script type="text/javascript" src="dojo-0.4.0/dojo.js"></script>
<script type="text/javascript">dojo.require("dojo.dnd.*");dojo.require("dojo.widget.*");</script>
<style>
.draggable
{
	border: 1px solid gray;
}
</style>
<table>
  <tr>
    <td width="50">
      <div id="draggable" class="draggable">
        some text for dragging It overflows the 
      </div>
	  <script>new dojo.dnd.HtmlDragSource(dojo.byId('draggable'), "draggable");</script>
    </td>
  </tr>
</table>        

comment:4 Changed 13 years ago by dylan

Milestone: 0.9

Feel free to scan the cla and email it to me: mail -at- dylans -dot- org

comment:5 Changed 12 years ago by Eugene Lazutkin

Resolution: fixed
Status: newclosed

Fixed in 0.9.

Note: See TracTickets for help on using tickets.