git.iko.soy/typeable/elm-ui
on master help sign in
update classifyDevice to capture phones if they're rotated AND desktops.
commit5ce0cabe64f7f99f2ef5af1147efe67bf9a5c37b authorMatthew Griffith <mdg.griffith@gmail.com> dateSun 21 Jul 2019, 11:07 (7 years ago) parent0d5388f
1 file changed+8−3
src/Element.elm+8−3
src/Element.elm+8−3
@@ -1559,18 +1559,23 @@ If you have more detailed concerns around responsiveness, it probably makes sens
15591559-}
15601560classifyDevice : { window | height : Int, width : Int } -> Device
15611561classifyDevice window =
1562+ -- Tested in this ellie:
1563+ -- https://ellie-app.com/68QM7wLW8b9a1
15621564 { class =
15631565 let
15641566 longSide =
15651567 max window.width window.height
1568+
1569+ shortSide =
1570+ min window.width window.height
15661571 in
1567− if longSide <= 600 then
1572+ if shortSide < 600 then
15681573 Phone
15691574
1570− else if longSide > 600 && longSide <= 1200 then
1575+ else if longSide <= 1200 then
15711576 Tablet
15721577
1573− else if longSide > 1200 && longSide <= 1800 then
1578+ else if longSide > 1200 && longSide <= 1920 then
15741579 Desktop
15751580
15761581 else