Skip to content

Commit 2b1bd5b

Browse files
committed
try to make the default vertical layout a bit better
1 parent ef3a4f0 commit 2b1bd5b

File tree

1 file changed

+30
-25
lines changed

1 file changed

+30
-25
lines changed

src/Debugger/Main.elm

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ type Popout
7777

7878

7979
type Layout
80-
= Vertical DragStatus Float
81-
| Horizontal DragStatus Float
80+
= Vertical DragStatus Float Float
81+
| Horizontal DragStatus Float Float
8282

8383

8484
type DragStatus
@@ -156,7 +156,7 @@ wrapInit metadata popout init flags =
156156
, metadata = Metadata.decode metadata
157157
, overlay = Overlay.none
158158
, popout = popout
159-
, layout = Horizontal Static 0.3
159+
, layout = Horizontal Static 0.3 0.5
160160
}
161161
, Cmd.map UserMsg userCommands
162162
)
@@ -356,25 +356,25 @@ jumpUpdate update index model =
356356
swapLayout : Layout -> Layout
357357
swapLayout layout =
358358
case layout of
359-
Horizontal s f -> Vertical s f
360-
Vertical s f -> Horizontal s f
359+
Horizontal s x y -> Vertical s x y
360+
Vertical s x y -> Horizontal s x y
361361

362362

363363
setDragStatus : DragStatus -> Layout -> Layout
364364
setDragStatus status layout =
365365
case layout of
366-
Horizontal _ fraction -> Horizontal status fraction
367-
Vertical _ fraction -> Vertical status fraction
366+
Horizontal _ x y -> Horizontal status x y
367+
Vertical _ x y -> Vertical status x y
368368

369369

370370
drag : DragInfo -> Layout -> Layout
371371
drag info layout =
372372
case layout of
373-
Horizontal status _ ->
374-
Horizontal status (info.x / info.width)
373+
Horizontal status _ y ->
374+
Horizontal status (info.x / info.width) y
375375

376-
Vertical status _ ->
377-
Vertical status (info.y / info.height)
376+
Vertical status x _ ->
377+
Vertical status x (info.y / info.height)
378378

379379

380380

@@ -518,8 +518,8 @@ popoutView model =
518518
toFlexDirection : Layout -> String
519519
toFlexDirection layout =
520520
case layout of
521-
Horizontal _ _ -> "row"
522-
Vertical _ _ -> "column-reverse"
521+
Horizontal _ _ _ -> "row"
522+
Vertical _ _ _ -> "column-reverse"
523523

524524

525525

@@ -536,8 +536,8 @@ toDragListeners layout =
536536
getDragStatus : Layout -> DragStatus
537537
getDragStatus layout =
538538
case layout of
539-
Horizontal status _ -> status
540-
Vertical status _ -> status
539+
Horizontal status _ _ -> status
540+
Vertical status _ _ -> status
541541

542542

543543
type alias DragInfo =
@@ -572,11 +572,11 @@ decodeDimension field =
572572
viewDragZone : Layout -> Html (Msg msg)
573573
viewDragZone layout =
574574
case layout of
575-
Horizontal _ fraction ->
575+
Horizontal _ x _ ->
576576
div
577577
[ style "position" "absolute"
578578
, style "top" "0"
579-
, style "left" (toPercent fraction)
579+
, style "left" (toPercent x)
580580
, style "margin-left" "-5px"
581581
, style "width" "10px"
582582
, style "height" "100%"
@@ -585,10 +585,10 @@ viewDragZone layout =
585585
]
586586
[]
587587

588-
Vertical _ fraction ->
588+
Vertical _ _ y ->
589589
div
590590
[ style "position" "absolute"
591-
, style "top" (toPercent fraction)
591+
, style "top" (toPercent y)
592592
, style "left" "0"
593593
, style "margin-top" "-5px"
594594
, style "width" "100%"
@@ -644,8 +644,8 @@ viewHistory maybeIndex history layout =
644644
toHistoryPercents : Layout -> (String, String)
645645
toHistoryPercents layout =
646646
case layout of
647-
Horizontal _ f -> ( toPercent f, "100%" )
648-
Vertical _ f -> ( "100%", toPercent (1 - f) )
647+
Horizontal _ x _ -> ( toPercent x, "100%" )
648+
Vertical _ _ y -> ( "100%", toPercent (1 - y) )
649649

650650

651651
viewHistorySlider : History model msg -> Maybe Int -> Html (Msg msg)
@@ -760,8 +760,8 @@ icon path =
760760
toHistoryIcon : Layout -> String
761761
toHistoryIcon layout =
762762
case layout of
763-
Horizontal _ _ -> "M13 1a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-10a3 3 0 0 1-3-3v-8a3 3 0 0 1 3-3z M13 3h-10a1 1 0 0 0-1 1v5h12v-5a1 1 0 0 0-1-1z M14 10h-12v2a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1z"
764-
Vertical _ _ -> "M0 4a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-10a3 3 0 0 1-3-3z M2 4v8a1 1 0 0 0 1 1h2v-10h-2a1 1 0 0 0-1 1z M6 3v10h7a1 1 0 0 0 1-1v-8a1 1 0 0 0-1-1z"
763+
Horizontal _ _ _ -> "M13 1a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-10a3 3 0 0 1-3-3v-8a3 3 0 0 1 3-3z M13 3h-10a1 1 0 0 0-1 1v5h12v-5a1 1 0 0 0-1-1z M14 10h-12v2a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1z"
764+
Vertical _ _ _ -> "M0 4a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-10a3 3 0 0 1-3-3z M2 4v8a1 1 0 0 0 1 1h2v-10h-2a1 1 0 0 0-1 1z M6 3v10h7a1 1 0 0 0 1-1v-8a1 1 0 0 0-1-1z"
765765

766766

767767

@@ -797,5 +797,10 @@ viewExpando expandoMsg expandoModel layout =
797797
toExpandoPercents : Layout -> (String, String)
798798
toExpandoPercents layout =
799799
case layout of
800-
Horizontal _ f -> ( toPercent (1 - f), "100%" )
801-
Vertical _ f -> ( "100%", toPercent f )
800+
Horizontal _ x _ -> ( toPercent (1 - x), "100%" )
801+
Vertical _ _ y -> ( "100%", toPercent y )
802+
803+
804+
-- No case/let/if in parentheses. Always new top-level function.
805+
-- No case/let/if within a let. Always new top-level function.
806+
-- Replace "creating variable to use in different branches" with "same function call in different branches"

0 commit comments

Comments
 (0)