Is DragNDrop still something that needs ot be implemented with Mouse. There 
seems to be so much support for dragging built into Html directly that we 
ought to be able to do things more directly in Em by now I would have 
thought?

On Wednesday, 7 September 2016 20:19:25 UTC+2, Ivan Uemlianin wrote:
>
> Dear James
>
> Thanks, that is very helpful.  Thanks both.
>
> Before today I had the impression it might not be possible at all.
>
> From both of your help, I'll try and put together (& publish) something 
> that is just bare Elm, with a html <ul> where you can draggingly re-order 
> the <li>s.  
>
> Best wishes
>
> Ivan
>
>
> On Wednesday, September 7, 2016 at 6:04:58 PM UTC+1, James Wilson wrote:
>>
>> Ivan alas you need the server to get as far as being able to see the DnD 
>> in practise! it's a stack/haskell thing so if you happen to be using stack 
>> it's quite straight forward (scripts/run-server.sh should do 
>> most/everything). for the client, an npm install and then npm run build 
>> should be enough to build and put it into the place run-server expects. 
>> I'll make proper instructions at some point but the App isn't quite there 
>> yet :)
>>
>> failing getting things going, looking at the code should give a fair 
>> idea. I'm basically putting elements wherever I need to to capture the 
>> relevant events (what did I click on to start a drag? what is my current 
>> drag above/below/between if anything?). a little css (dnd.scss) makes sure 
>> the drag helper elements are in the right place. the list of html my 
>> Dnd.view expects has each item paired with a unique ID String so that my 
>> drag thing can use these IDs to track where the drag currently is between 
>> and inform the outside world. It also exposes a few functions that the 
>> outside world can use to query the current Dnd model to find out about 
>> things. I use this in Main.elm to decide when and where to render an 
>> overlay and what should be in the overlay.
>>
>> It's a little rough still but seems to work really reliably so far; I was 
>> looking for a solution that didnt break if you went a bit nuts throwing the 
>> mouse around etc! It's also 100% Elm which I'm pleased with. There are def 
>> things that Elm makes difficult that I had to work around, for instance 
>> finding exactly where in the item I clicked would be nice, but it's also 
>> hard (impossible?) in Elm if the element has children, as the mousedown 
>> event target isn't always the element you care about etc.
>>
>> Anyway, hope it helps :)
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to