Changes
2 changed files (+111/-26)
-
-
@@ -29,6 +29,16 @@ Pointed _ ->"pointed" tipStyleToCompactString : TipStyle -> String tipStyleToCompactString style = case style of Round -> "r" Pointed _ -> "p" type alias BuckleHole = -- Distance between a base hole (center hole) and case-side strap end. { distance : Length
-
@@ -80,6 +90,16 @@ Folded ->"folded" loopStyleToCompactString : LoopStyle -> String loopStyleToCompactString style = case style of Simple -> "s" Folded -> "f" type alias Loops = { fixed : Maybe FixedLoop , free : Maybe FreeLoop
-
@@ -122,6 +142,16 @@ WhiteOnBlack ->"white-on-black" colorSchemaToCompactString : ColorSchema -> String colorSchemaToCompactString schema = case schema of BlackOnWhite -> "w" WhiteOnBlack -> "b" type alias Rendering = { size : CanvasSize , margin : Length
-
@@ -147,6 +177,16 @@ Tapered _ ->"tapered" profileToCompactString : Profile -> String profileToCompactString profile = case profile of Straight -> "s" Tapered _ -> "t" type alias Parameters = { shoulderWidth : Length , longPiece : LongPiece
-
@@ -232,20 +272,48 @@ Compact ->Key.toCompactID in [ ( "version", "1.0" ) , ( toString TipStyle, tipStyleToString params.longPiece.tip ) , ( toString TipStyle , case mode of Regular -> tipStyleToString params.longPiece.tip Compact -> tipStyleToCompactString params.longPiece.tip ) , ( toString ShoulderWidth, String.fromFloat (toMM params.shoulderWidth) ) , ( toString PaddingOffset, String.fromFloat (toMM params.paddingOffset) ) , ( toString LongPieceLength, String.fromFloat (toMM params.longPiece.length) ) , ( toString LoopStyle, loopStyleToString params.shortPiece.loops.style ) , ( toString LoopStyle , case mode of Regular -> loopStyleToString params.shortPiece.loops.style Compact -> loopStyleToCompactString params.shortPiece.loops.style ) , ( toString ShortPieceLength, String.fromFloat (toMM params.shortPiece.length) ) , ( toString CanvasMargin, String.fromFloat (toMM params.rendering.margin) ) , ( toString LineWidth, String.fromFloat (toMM params.rendering.lineWidth) ) , ( toString ColorSchema, colorSchemaToString params.rendering.colorSchema ) , ( toString ColorSchema , case mode of Regular -> colorSchemaToString params.rendering.colorSchema Compact -> colorSchemaToCompactString params.rendering.colorSchema ) , ( toString BuckleHoleAdjustments, String.fromInt params.longPiece.buckleHole.adjustments ) , ( toString BuckleHoleDistance, String.fromFloat (toMM params.longPiece.buckleHole.distance) ) , ( toString BuckleHoleInterval, String.fromFloat (toMM params.longPiece.buckleHole.interval) ) , ( toString BuckleHoleDiameter, String.fromFloat (toMM params.longPiece.buckleHole.diameter) ) , ( toString Profile, profileKind params.profile ) , ( toString Profile , case mode of Regular -> profileKind params.profile Compact -> profileToCompactString params.profile ) ] |> (++) (case params.longPiece.tip of
-
-
-
@@ -151,8 +151,14 @@parseColorSchema : String -> Result Error ColorSchema parseColorSchema text = case text of "b" -> Ok WhiteOnBlack "white-on-black" -> Ok WhiteOnBlack "w" -> Ok BlackOnWhite "black-on-white" -> Ok BlackOnWhite
-
@@ -164,8 +170,14 @@parseLoopStyle : String -> Result Error LoopStyle parseLoopStyle text = case text of "s" -> Ok Simple "simple" -> Ok Simple "f" -> Ok Folded "folded" -> Ok Folded
-
@@ -316,21 +328,22 @@parseTipStyle : ParametersDict -> Result Errors Parameters.TipStyle parseTipStyle fields = case getKey TipStyle fields of Just "round" -> Ok Parameters.Round Just text -> if text == "r" || text == "round" then Ok Parameters.Round Just "pointed" -> case parseField TipSharpness (parseInt constraints.longPiece.tipSharpness) fields of Ok sharpness -> Ok (Parameters.Pointed sharpness) else if text == "p" || text == "pointed" then case parseField TipSharpness (parseInt constraints.longPiece.tipSharpness) fields of Ok sharpness -> Ok (Parameters.Pointed sharpness) Err err -> mkErrors [ ( TipSharpness, Just err ) ] |> Err Err err -> mkErrors [ ( TipSharpness, Just err ) ] |> Err Just text -> mkErrors [ ( TipStyle, Just (NonexistentVariant text) ) ] |> Err else mkErrors [ ( TipStyle, Just (NonexistentVariant text) ) ] |> Err Nothing -> mkErrors [ ( TipStyle, Just MissingValue ) ]
-
@@ -396,19 +409,23 @@parseProfile : ParametersDict -> Result Errors Parameters.Profile parseProfile fields = case getKey Profile fields of Just "straight" -> Ok Parameters.Straight Just text -> if text == "s" || text == "straight" then Ok Parameters.Straight Just "tapered" -> case parseField TaperTo (parseLength constraints.taperTo) fields of Ok taperTo -> Ok (Parameters.Tapered taperTo) else if text == "t" || text == "tapered" then case parseField TaperTo (parseLength constraints.taperTo) fields of Ok taperTo -> Ok (Parameters.Tapered taperTo) Err err -> Err (mkErrors [ ( TaperTo, Just err ) ]) Err err -> Err (mkErrors [ ( TaperTo, Just err ) ]) profile -> Err (mkErrors [ ( Profile, Just (NonexistentVariant (Maybe.withDefault "" profile)) ) ]) else Err (mkErrors [ ( Profile, Just (NonexistentVariant text) ) ]) Nothing -> Err (mkErrors [ ( Profile, Just MissingValue ) ]) parse : ParametersDict -> Result Errors Parameters
-