refactor: fix elm-review suggestions
This commit is contained in:
parent
595f7ddceb
commit
504c5f860d
3 changed files with 102 additions and 102 deletions
4
elm.json
4
elm.json
|
@ -18,7 +18,6 @@
|
||||||
"ianmackenzie/elm-triangular-mesh": "1.1.0",
|
"ianmackenzie/elm-triangular-mesh": "1.1.0",
|
||||||
"ianmackenzie/elm-units": "2.10.0",
|
"ianmackenzie/elm-units": "2.10.0",
|
||||||
"mdgriffith/elm-ui": "1.1.8",
|
"mdgriffith/elm-ui": "1.1.8",
|
||||||
"rl-king/elm-scroll-to": "1.1.2",
|
|
||||||
"w0rm/elm-obj-file": "1.2.1"
|
"w0rm/elm-obj-file": "1.2.1"
|
||||||
},
|
},
|
||||||
"indirect": {
|
"indirect": {
|
||||||
|
@ -31,8 +30,7 @@
|
||||||
"ianmackenzie/elm-float-extra": "1.1.0",
|
"ianmackenzie/elm-float-extra": "1.1.0",
|
||||||
"ianmackenzie/elm-geometry-linear-algebra-interop": "2.0.2",
|
"ianmackenzie/elm-geometry-linear-algebra-interop": "2.0.2",
|
||||||
"ianmackenzie/elm-interval": "3.1.0",
|
"ianmackenzie/elm-interval": "3.1.0",
|
||||||
"ianmackenzie/elm-units-interval": "3.2.0",
|
"ianmackenzie/elm-units-interval": "3.2.0"
|
||||||
"tad-lispy/springs": "1.0.5"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"elm-version": "0.19.1",
|
"elm-version": "0.19.1",
|
||||||
|
|
|
@ -12,7 +12,6 @@ when inside the directory containing this file.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
import Docs.ReviewAtDocs
|
import Docs.ReviewAtDocs
|
||||||
import NoConfusingPrefixOperator
|
|
||||||
import NoDebug.Log
|
import NoDebug.Log
|
||||||
import NoDebug.TodoOrToString
|
import NoDebug.TodoOrToString
|
||||||
import NoExposingEverything
|
import NoExposingEverything
|
||||||
|
@ -36,7 +35,6 @@ import Simplify
|
||||||
config : List Rule
|
config : List Rule
|
||||||
config =
|
config =
|
||||||
[ Docs.ReviewAtDocs.rule
|
[ Docs.ReviewAtDocs.rule
|
||||||
, NoConfusingPrefixOperator.rule
|
|
||||||
, NoDebug.Log.rule
|
, NoDebug.Log.rule
|
||||||
, NoDebug.TodoOrToString.rule
|
, NoDebug.TodoOrToString.rule
|
||||||
|> Rule.ignoreErrorsForDirectories [ "tests/" ]
|
|> Rule.ignoreErrorsForDirectories [ "tests/" ]
|
||||||
|
|
198
src/Main.elm
198
src/Main.elm
|
@ -1,4 +1,4 @@
|
||||||
module Main exposing (Flags, Model, Msg, Object3d, main, sitemap)
|
module Main exposing (Flags, Model, Msg, Object3d, main)
|
||||||
|
|
||||||
import Angle
|
import Angle
|
||||||
import Array
|
import Array
|
||||||
|
@ -176,10 +176,6 @@ blender t =
|
||||||
n =
|
n =
|
||||||
length mainColors
|
length mainColors
|
||||||
|
|
||||||
p : Float
|
|
||||||
p =
|
|
||||||
frac (t * toFloat n)
|
|
||||||
|
|
||||||
c1 : Maybe ( Float, Float, Float )
|
c1 : Maybe ( Float, Float, Float )
|
||||||
c1 =
|
c1 =
|
||||||
getAt (floor (t * toFloat n)) mainColors
|
getAt (floor (t * toFloat n)) mainColors
|
||||||
|
@ -206,6 +202,11 @@ blender t =
|
||||||
Color.rgb255 173 111 101
|
Color.rgb255 173 111 101
|
||||||
|
|
||||||
Just color1 ->
|
Just color1 ->
|
||||||
|
let
|
||||||
|
p : Float
|
||||||
|
p =
|
||||||
|
frac (t * toFloat n)
|
||||||
|
in
|
||||||
-- blend both colors
|
-- blend both colors
|
||||||
blend p color1 color2
|
blend p color1 color2
|
||||||
|
|
||||||
|
@ -461,6 +462,7 @@ id =
|
||||||
getPaths : String -> List String
|
getPaths : String -> List String
|
||||||
getPaths base =
|
getPaths base =
|
||||||
let
|
let
|
||||||
|
root : String
|
||||||
root =
|
root =
|
||||||
"/" ++ base
|
"/" ++ base
|
||||||
in
|
in
|
||||||
|
@ -470,6 +472,7 @@ getPaths base =
|
||||||
itemize : List String -> a -> List ( String, a )
|
itemize : List String -> a -> List ( String, a )
|
||||||
itemize multikeys entry =
|
itemize multikeys entry =
|
||||||
let
|
let
|
||||||
|
key : Maybe String
|
||||||
key =
|
key =
|
||||||
List.head multikeys
|
List.head multikeys
|
||||||
in
|
in
|
||||||
|
@ -493,6 +496,7 @@ sitemap =
|
||||||
loadUrl : Model -> List (Html Msg)
|
loadUrl : Model -> List (Html Msg)
|
||||||
loadUrl model =
|
loadUrl model =
|
||||||
let
|
let
|
||||||
|
req : Maybe (Model -> List (Html Msg))
|
||||||
req =
|
req =
|
||||||
Dict.get model.url.path sitemap
|
Dict.get model.url.path sitemap
|
||||||
in
|
in
|
||||||
|
@ -1526,98 +1530,6 @@ view3DEntries entry model =
|
||||||
else
|
else
|
||||||
Scene3d.mesh textures (Mesh.texturedFacets mesh)
|
Scene3d.mesh textures (Mesh.texturedFacets mesh)
|
||||||
|
|
||||||
height : Float
|
|
||||||
height =
|
|
||||||
case entry of
|
|
||||||
"A" ->
|
|
||||||
10
|
|
||||||
|
|
||||||
"B" ->
|
|
||||||
7
|
|
||||||
|
|
||||||
"C" ->
|
|
||||||
5
|
|
||||||
|
|
||||||
"E" ->
|
|
||||||
1
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
2
|
|
||||||
|
|
||||||
perspective : Angle.Angle
|
|
||||||
perspective =
|
|
||||||
let
|
|
||||||
theta : Float
|
|
||||||
theta =
|
|
||||||
180 * frac (model.angle / 180)
|
|
||||||
|
|
||||||
winding : Float
|
|
||||||
winding =
|
|
||||||
360 * frac (model.angle / 360)
|
|
||||||
|
|
||||||
direction : Float
|
|
||||||
direction =
|
|
||||||
abs (180 - winding) / (180 - winding)
|
|
||||||
|
|
||||||
interp : Float -> Float -> Angle.Angle
|
|
||||||
interp a b =
|
|
||||||
Angle.degrees
|
|
||||||
(if direction > 0 then
|
|
||||||
a + (b - a) * theta / 180
|
|
||||||
|
|
||||||
else
|
|
||||||
b + (a - b) * theta / 180
|
|
||||||
)
|
|
||||||
in
|
|
||||||
case entry of
|
|
||||||
"J" ->
|
|
||||||
interp -45 30
|
|
||||||
|
|
||||||
"E" ->
|
|
||||||
interp 30 110
|
|
||||||
|
|
||||||
"F" ->
|
|
||||||
interp 140 230
|
|
||||||
|
|
||||||
"G" ->
|
|
||||||
interp 230 290
|
|
||||||
|
|
||||||
"H" ->
|
|
||||||
interp 290 315
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
Angle.degrees model.angle
|
|
||||||
|
|
||||||
orbit : Float
|
|
||||||
orbit =
|
|
||||||
case entry of
|
|
||||||
"A" ->
|
|
||||||
4
|
|
||||||
|
|
||||||
"B" ->
|
|
||||||
6
|
|
||||||
|
|
||||||
"C" ->
|
|
||||||
6
|
|
||||||
|
|
||||||
"D" ->
|
|
||||||
10
|
|
||||||
|
|
||||||
"F" ->
|
|
||||||
12
|
|
||||||
|
|
||||||
"G" ->
|
|
||||||
10
|
|
||||||
|
|
||||||
"J" ->
|
|
||||||
12
|
|
||||||
|
|
||||||
"H" ->
|
|
||||||
11
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
7
|
|
||||||
|
|
||||||
camera : Camera3d.Camera3d Length.Meters coordinates
|
camera : Camera3d.Camera3d Length.Meters coordinates
|
||||||
camera =
|
camera =
|
||||||
Camera3d.perspective
|
Camera3d.perspective
|
||||||
|
@ -1626,6 +1538,98 @@ view3DEntries entry model =
|
||||||
{ focalPoint = Point3d.origin
|
{ focalPoint = Point3d.origin
|
||||||
, eyePoint =
|
, eyePoint =
|
||||||
let
|
let
|
||||||
|
orbit : Float
|
||||||
|
orbit =
|
||||||
|
case entry of
|
||||||
|
"A" ->
|
||||||
|
4
|
||||||
|
|
||||||
|
"B" ->
|
||||||
|
6
|
||||||
|
|
||||||
|
"C" ->
|
||||||
|
6
|
||||||
|
|
||||||
|
"D" ->
|
||||||
|
10
|
||||||
|
|
||||||
|
"F" ->
|
||||||
|
12
|
||||||
|
|
||||||
|
"G" ->
|
||||||
|
10
|
||||||
|
|
||||||
|
"J" ->
|
||||||
|
12
|
||||||
|
|
||||||
|
"H" ->
|
||||||
|
11
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
7
|
||||||
|
|
||||||
|
perspective : Angle.Angle
|
||||||
|
perspective =
|
||||||
|
let
|
||||||
|
phi : Float
|
||||||
|
phi =
|
||||||
|
180 * frac (model.angle / 180)
|
||||||
|
|
||||||
|
winding : Float
|
||||||
|
winding =
|
||||||
|
360 * frac (model.angle / 360)
|
||||||
|
|
||||||
|
direction : Float
|
||||||
|
direction =
|
||||||
|
abs (180 - winding) / (180 - winding)
|
||||||
|
|
||||||
|
interp : Float -> Float -> Angle.Angle
|
||||||
|
interp a b =
|
||||||
|
Angle.degrees
|
||||||
|
(if direction > 0 then
|
||||||
|
a + (b - a) * phi / 180
|
||||||
|
|
||||||
|
else
|
||||||
|
b + (a - b) * phi / 180
|
||||||
|
)
|
||||||
|
in
|
||||||
|
case entry of
|
||||||
|
"J" ->
|
||||||
|
interp -45 30
|
||||||
|
|
||||||
|
"E" ->
|
||||||
|
interp 30 110
|
||||||
|
|
||||||
|
"F" ->
|
||||||
|
interp 140 230
|
||||||
|
|
||||||
|
"G" ->
|
||||||
|
interp 230 290
|
||||||
|
|
||||||
|
"H" ->
|
||||||
|
interp 290 315
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
Angle.degrees model.angle
|
||||||
|
|
||||||
|
height : Float
|
||||||
|
height =
|
||||||
|
case entry of
|
||||||
|
"A" ->
|
||||||
|
10
|
||||||
|
|
||||||
|
"B" ->
|
||||||
|
7
|
||||||
|
|
||||||
|
"C" ->
|
||||||
|
5
|
||||||
|
|
||||||
|
"E" ->
|
||||||
|
1
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
2
|
||||||
|
|
||||||
theta : Angle.Angle
|
theta : Angle.Angle
|
||||||
theta =
|
theta =
|
||||||
perspective
|
perspective
|
||||||
|
|
Loading…
Reference in a new issue