A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve playlist drag & drop

+26 -38
+1
CHANGELOG.md
··· 5 5 - Adds ability to download a playlist as a zip file 6 6 - Fixes dark styles for add-to-playlist overlay 7 7 - Improves CORS information a little bit 8 + - Improves playlist drag & drop (now moves selection instead of item under cursor) 8 9 - No longer scrolls track list to the top when moving things in a playlist or when processing tracks 9 10 - Switches key bindings for arrow up and down 10 11
+8 -2
src/Applications/UI/Tracks.elm
··· 451 451 in 452 452 return { model | selectedTrackIndexes = selection } 453 453 454 - MoveTrackInSelectedPlaylist moveFromTo -> 454 + MoveTrackInSelectedPlaylist { to } -> 455 455 case model.selectedPlaylist of 456 456 Just p -> 457 457 let 458 + moveParams = 459 + { from = Maybe.withDefault 0 (List.head model.selectedTrackIndexes) 460 + , to = to 461 + , amount = List.length model.selectedTrackIndexes 462 + } 463 + 458 464 updatedPlaylist = 459 - { p | tracks = List.move moveFromTo p.tracks } 465 + { p | tracks = List.move moveParams p.tracks } 460 466 in 461 467 { model | selectedPlaylist = Just updatedPlaylist } 462 468 |> reviseCollection arrange
+1 -1
src/Applications/UI/Tracks/Reply.elm
··· 13 13 = Transcend (List UI.Reply) 14 14 -- 15 15 | MarkAsSelected Int { shiftKey : Bool } 16 - | MoveTrackInSelectedPlaylist { from : Int, to : Int } 16 + | MoveTrackInSelectedPlaylist { to : Int } 17 17 | ShowTrackMenuWithoutDelay Int { alt : Bool } Coordinates 18 18 | ShowTrackMenuWithSmallDelay Int { alt : Bool } Coordinates 19 19 | SortBy SortBy
+1 -2
src/Applications/UI/Tracks/Scene/List.elm
··· 81 81 returnRepliesWithModel 82 82 { model | dnd = newDnD } 83 83 [ MoveTrackInSelectedPlaylist 84 - { from = Maybe.withDefault 0 <| DnD.modelSubject newDnD 85 - , to = Maybe.withDefault 0 <| DnD.modelTarget newDnD 84 + { to = Maybe.withDefault 0 (DnD.modelTarget newDnD) 86 85 } 87 86 , Transcend uiReplies 88 87 ]
+15 -33
src/Library/List/Ext.elm
··· 28 28 {-| Move an item "from" an index "to" another index. 29 29 Putting the item in front of the `to` index. 30 30 31 - >>> move { from = 0, to = 2 } [1, 2, 3] 31 + >>> move { from = 0, to = 2, amount = 1 } [1, 2, 3] 32 32 [2, 1, 3] 33 33 34 - >>> move { from = 2, to = 0 } [1, 2, 3] 34 + >>> move { from = 2, to = 0, amount = 1 } [1, 2, 3] 35 35 [3, 1, 2] 36 36 37 - -} 38 - move : { from : Int, to : Int } -> List a -> List a 39 - move opts list = 40 - let 41 - from = 42 - opts.from 43 - 44 - to = 45 - if opts.to > from then 46 - opts.to - 1 47 - 48 - else 49 - opts.to 50 - 51 - maybeItemToMove = 52 - List.getAt from list 53 - in 54 - list 55 - |> List.removeAt from 56 - |> List.indexedFoldr 57 - (\idx existingItem acc -> 58 - if idx == to then 59 - case maybeItemToMove of 60 - Just itemToMove -> 61 - List.append [ itemToMove, existingItem ] acc 37 + >>> move { from = 2, to = 7, amount = 3 } [0, 1, 2, 3, 4, 5, 6, 7] 38 + [0, 1, 5, 6, 2, 3, 4, 7] 62 39 63 - Nothing -> 64 - existingItem :: acc 40 + >>> move { from = 2, to = 1, amount = 3 } [0, 1, 2, 3, 4, 5, 6, 7] 41 + [0, 2, 3, 4, 1, 5, 6, 7] 65 42 66 - else 67 - existingItem :: acc 68 - ) 69 - [] 43 + -} 44 + move : { amount : Int, from : Int, to : Int } -> List a -> List a 45 + move { from, to, amount } list = 46 + [] 47 + ++ (list |> List.take (min from to)) 48 + ++ (list |> List.take to |> List.drop (from + amount)) 49 + ++ (list |> List.drop from |> List.take amount) 50 + ++ (list |> List.take from |> List.drop to) 51 + ++ (list |> List.drop (max (from + amount) to)) 70 52 71 53 72 54 pickIndexes : List Int -> List a -> List a