Changes
4 changed files (+72/-12)
-
-
@@ -46,6 +46,7 @@ letfields = Dict.fromList [ ( Key.toString LugWidth, String.fromFloat (toMM params.lugWidth) ) , ( Key.toString SurfaceThickness, String.fromFloat (toMM params.thickness) ) , ( Key.toString LiningThickness, String.fromFloat (toMM params.lining) ) , ( Key.toString BuckleHoleCount, String.fromInt params.longPiece.buckleHole.count ) , ( Key.toString BuckleHoleDiameter, String.fromFloat (toMM params.longPiece.buckleHole.diameter) )
-
@@ -163,21 +164,30 @@ parse fields =case ( ( parseField LugWidth (parseLength constraints.lugWidth) fields , parseField LiningThickness (parseLength constraints.lining) fields , parseField SurfaceThickness (parseLength constraints.thickness) fields ) , parseLongPiece fields , parseCanvas fields ) of ( ( Ok lugWidth, Ok lining ), Ok longPiece, Ok rendering ) -> ( ( Ok lugWidth, Ok lining, Ok thickness ), Ok longPiece, Ok rendering ) -> let base = Parameters.default in Ok { base | lugWidth = lugWidth, lining = lining, longPiece = longPiece, rendering = rendering } Ok { base | lugWidth = lugWidth , lining = lining , thickness = thickness , longPiece = longPiece , rendering = rendering } ( ( lugWidth, lining ), longPiece, rendering ) -> ( ( lugWidth, lining, thickness ), longPiece, rendering ) -> [ mkErrors [ ( LugWidth, getError lugWidth ) ] , mkErrors [ ( LiningThickness, getError lining ) ] , mkErrors [ ( SurfaceThickness, getError thickness ) ] , getError longPiece |> Maybe.withDefault Dict.empty , getError rendering |> Maybe.withDefault Dict.empty ]
-
@@ -444,8 +454,16 @@ , disabled = False, attrs = step "1.0" :: lengthFieldAttrs constraints.lugWidth } , numberField model { key = SurfaceThickness , title = [ text "Surface Leather Thickness" ] , description = [ text "Thickness of surface leather." ] , unit = Just "mm" , disabled = False , attrs = step "0.1" :: lengthFieldAttrs constraints.thickness } , numberField model { key = LiningThickness , title = [ text "Lining Thickness" ] , title = [ text "Lining Leather Thickness" ] , description = [ text "Thickness of lining leather. Set to 0 to disable lining generation." ]
-
-
-
@@ -40,6 +40,7 @@ type alias Parameters ={ lugWidth : NumberConstraints Length , longPiece : LongPiece , lining : NumberConstraints Length , thickness : NumberConstraints Length , rendering : Rendering }
-
@@ -54,6 +55,7 @@ , diameter = { min = Just (mm 1), max = Just (mm 10) }} } , lining = { min = Just (mm 0), max = Just (mm 5) } , thickness = { min = Just (mm 0.1), max = Just (mm 5) } , rendering = { margin = { min = Just (mm 0), max = Just (mm 20) } , lineWidth = { min = Just (mm 0.1), max = Just (mm 1) }
-
-
-
@@ -12,6 +12,7 @@type Key = LugWidth | SurfaceThickness | LiningThickness | BuckleHoleCount | BuckleHoleDiameter
-
@@ -25,6 +26,9 @@ toString key =case key of LugWidth -> "lug-width" SurfaceThickness -> "thickness" LiningThickness -> "lining-thickness"
-
-
-
@@ -53,12 +53,6 @@ |> Tuple.mapBoth toMM toMMmargin = toMM params.rendering.margin lugWidth = toMM params.lugWidth gap = toMM params.rendering.gap in svg (viewBox (String.join " " [ "0", "0", String.fromInt (ceiling canvasWidth), String.fromInt (ceiling canvasHeight) ])
-
@@ -90,8 +84,7 @@ ][] ] ] , longPiece params (TopLeft ( margin, margin )) , shortPiece params (TopLeft ( margin + lugWidth + gap, margin )) , surfacePieces params (TopLeft ( margin, margin )) , linings params (TopRight ( canvasWidth - margin, margin )) ]
-
@@ -238,6 +231,49 @@ , stroke "currentColor", strokeWidth (toMM params.rendering.lineWidth |> String.fromFloat) , strokeDasharray "1 0.5" ] surfacePieces : Parameters -> Anchor -> Svg msg surfacePieces params anchor = let lugWidth = toMM params.lugWidth gap = toMM params.rendering.gap headerHeight = 5.0 sectionWidth = lugWidth * 2 + gap ( ox, oy ) = topLeftFor anchor (Size sectionWidth (headerHeight + gap / 2 + Basics.max (.height (longPieceSize params)) (.height (shortPieceSize params)) ) ) in g [] [ longPiece params (TopLeft ( ox, oy + headerHeight + gap / 2 )) , shortPiece params (TopLeft ( ox + lugWidth + gap, oy + headerHeight + gap / 2 )) , text_ [ x (ox + sectionWidth / 2 |> String.fromFloat) , y (oy + 4 |> String.fromFloat) , fontSize "5" , fontWeight "100" , textAnchor "middle" , fill "currentColor" ] [ text ("Surfaces / t = " ++ (toMM params.thickness |> String.fromFloat) ++ "mm") ] ] longPieceSize : Parameters -> Size
-