git.iko.soy/typeable/elm-ui
on master help sign in
Change classifyDevice function to support rotated devices.
f61850eRosario Pulella
src/Element.elm+11−4
@@ -1536,13 +1536,21 @@ type Orientation
1536classifyDevice : { window | height : Int, width : Int } -> Device
1536classifyDevice : { window | height : Int, width : Int } -> Device
1537classifyDevice window =
1537classifyDevice window =
1538 { class =
1538 { class =
1539+ let
1540+ shortSide =
1539− if window.width <= 600 then
1541+ if window.width < window.height then
1542+ window.width
1543+
1544+ else
1545+ window.height
1546+ in
1547+ if shortSide <= 600 then
1540 Phone
1548 Phone
1541
1549
1542− else if window.width > 600 && window.width <= 1200 then
1550+ else if shortSide > 600 && shortSide <= 1200 then
1543 Tablet
1551 Tablet
1544
1552
1545− else if window.width > 1200 && window.width <= 1800 then
1553+ else if shortSide > 1200 && shortSide <= 1800 then
1546 Desktop
1554 Desktop
1547
1555
1548 else
1556 else
@@ -1555,7 +1563,6 @@ classifyDevice window =
1555 Landscape
1563 Landscape
1556 }
1564 }
1557
1565
1558−
1559{-| When designing it's nice to use a modular scale to set spacial rythms.
1566{-| When designing it's nice to use a modular scale to set spacial rythms.
1560
1567
1561 scaled =
1568 scaled =