git.iko.soy/typeable/elm-ui
on master help sign in
Change classifyDevice function to support rotated devices.
commitf61850e90d2abdd0226974c154b4a44959d2a104 authorRosario Pulella <RosarioPulella@gmail.com> dateMon 4 Feb 2019, 21:45 (8 years ago) parented45160
1 file changed+11−4
src/Element.elm+11−4
src/Element.elm+11−4
@@ -1536,13 +1536,21 @@ type Orientation
15361536classifyDevice : { window | height : Int, width : Int } -> Device
15371537classifyDevice window =
15381538 { class =
1539− if window.width <= 600 then
1539+ let
1540+ shortSide =
1541+ if window.width < window.height then
1542+ window.width
1543+
1544+ else
1545+ window.height
1546+ in
1547+ if shortSide <= 600 then
15401548 Phone
15411549
1542− else if window.width > 600 && window.width <= 1200 then
1550+ else if shortSide > 600 && shortSide <= 1200 then
15431551 Tablet
15441552
1545− else if window.width > 1200 && window.width <= 1800 then
1553+ else if shortSide > 1200 && shortSide <= 1800 then
15461554 Desktop
15471555
15481556 else
@@ -1555,7 +1563,6 @@ classifyDevice window =
15551563 Landscape
15561564 }
15571565
1558−
15591566{-| When designing it's nice to use a modular scale to set spacial rythms.
15601567
15611568 scaled =