Re: [whatwg] Proposed addition to Drag and Drop API

I tested locally and it works for me--if I set a specific element as the
drag image, it gets used instead of the entire draggable element.

Daniel


On Mon, Jul 2, 2012 at 10:06 AM, Alex Bain <alex@alexba.in> wrote:

> I did a bit of reading about what the WhatWG spec says setDragImage should
> do and wanted to ensure I understand what the spec is saying and how Webkit
> is behaving.
>
> Spec:
> http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dom-datatransfer-setdragimage
>
> The spec says defines "setDragImage" as: setDragImage(element, x, y)
>
> Element argument is defined as: "If the element argument is an img
> element, then set the drag data store bitmap to the element's image (at its
> intrinsic size); otherwise, set the drag data store bitmap to an image
> generated from the given element (the exact mechanism for doing so is not
> currently specified)."
>
> This says, if I'm understanding it correctly, that I can provide any
> element as the first argument and a bitmap image will be generated as a
> drag image. This would allow me to accomplish what I'm trying to do
> (setting a small drag element to represent a larger draggable container).
> However, in my testing, Webkit will not render anything unless the element
> specified is an image.
>
> Am I misunderstanding the spec, or might this be a bug in the
> implementation?
>
> Thanks,
>
> - Alex
>
> On Friday, June 29, 2012 at 4:37 PM, Alex Bain wrote:
>
>  @Ryosuke - I do not have a concrete proposal but would be interested in
> helping to work one out. I had idly considered a content attribute but
> think that specifying an element (perhaps via a function called
> setDragElement()) would be a simple implementation.
>
> @Daniel - I had thought that was possible but in my testing I was not able
> to get it to work. I had tried referencing an existing element as well as
> creating a new element but neither were visible while dragging [in Chrome].
>
> On Friday, June 29, 2012 at 4:30 PM, Daniel Cheng wrote:
>
> Can't you use setDragImage() and pass it the element that holds the post
> title?
>
> Daniel
>
>
> On Fri, Jun 29, 2012 at 4:27 PM, Ryosuke Niwa <rniwa@webkit.org> wrote:
>
> On Fri, Jun 29, 2012 at 4:24 PM, Alex Bain <alex@alexba.in> wrote:
>
> I would prefer not to visually drag the entire post around (which is what
> happens if I set draggable to true on the post container). My goal is to
> set draggable on a container element and only show a small element when the
> user starts dragging.
>
>
> Ah, that's an interesting use case. Thanks for clarification. Do you have
> a concrete proposal for this? (e.g. adding new content attribute / element).
>
> - Ryosuke
>
>
>
>
>

Received on Monday, 2 July 2012 20:51:07 UTC