Changes
6 changed files (+119/-13)
-
-
@@ -168,6 +168,7 @@ type alias Parameters =, shortPiece : ShortPiece , caseSideFlap : Length , paddingOffset : Length , topMargin : Length , profile : Profile , rendering : Rendering }
-
@@ -217,6 +218,7 @@ default =} , caseSideFlap = mm 20 , paddingOffset = mm 5 , topMargin = mm 5 , profile = Straight , rendering = { size = A4
-
@@ -254,6 +256,7 @@ toDict mode params =) , ( toString ShoulderWidth, String.fromFloat (toMM params.shoulderWidth) ) , ( toString PaddingOffset, String.fromFloat (toMM params.paddingOffset) ) , ( toString TopMargin, String.fromFloat (toMM params.topMargin) ) , ( toString LongPieceLength, String.fromFloat (toMM params.longPiece.length) ) , ( toString LoopStyle , case mode of
-
-
-
@@ -560,6 +560,16 @@ view model =, disabled = False , attrs = step "1.0" :: lengthFieldAttrs constraints.paddingOffset } , numberField model { key = TopMargin , description = [ text "Margin (outer offset) of the top pieces. " , text "Set to 0mm to disable." ] , unit = Just "mm" , disabled = False , attrs = step "1.0" :: lengthFieldAttrs constraints.topMargin } , choiceField model { key = Profile , description = [ text "Shape of the straps." ]
-
-
-
@@ -71,6 +71,7 @@ type alias Parameters =, shortPiece : ShortPiece , caseSideFlap : NumberConstraints Length , paddingOffset : NumberConstraints Length , topMargin : NumberConstraints Length , taperTo : NumberConstraints Length , rendering : Rendering }
-
@@ -106,6 +107,7 @@ constraints =} , caseSideFlap = { min = Just (mm 0), max = Just (mm 50) } , paddingOffset = { min = Just (mm 0), max = Just (mm 14) } , topMargin = { min = Just (mm 0), max = Just (mm 10) } , taperTo = { min = Just (mm 5), max = Just (mm 28) } , rendering = { margin = { min = Just (mm 0), max = Just (mm 20) }
-
-
-
@@ -15,6 +15,7 @@ type Key| CaseSideFlap | BuckleSideFlap | PaddingOffset | TopMargin | TipStyle | TipSharpness | Profile
-
@@ -69,6 +70,9 @@ toString key =PaddingOffset -> "padding-offset" TopMargin -> "top-margin" BuckleHoleDistance -> "buckle-hole-distance"
-
@@ -151,6 +155,9 @@ toLabel key =PaddingOffset -> "Padding offset" TopMargin -> "Top margin" BuckleHoleDistance -> "Center hole at"
-
@@ -283,3 +290,6 @@ toCompactID key =BuckleSideFlap -> "p" TopMargin -> "q"
-
-
-
@@ -415,6 +415,8 @@ parse fields =( ( parseField ShoulderWidth (parseLength constraints.shoulderWidth) fields , parseOptionalField PaddingOffset (parseLength constraints.paddingOffset) fields |> Result.map (Maybe.withDefault (mm 0)) , parseOptionalField TopMargin (parseLength constraints.topMargin) fields |> Result.map (Maybe.withDefault (mm 0)) ) , ( parseLongPiece fields , parseShortPiece fields
-
@@ -426,21 +428,23 @@ parse fields =) ) of ( ( Ok shoulderWidth, Ok paddingOffset ), ( Ok longPiece, Ok shortPiece, Ok profile ), ( Ok rendering, Ok caseSideFlap ) ) -> ( ( Ok shoulderWidth, Ok paddingOffset, Ok topMargin ), ( Ok longPiece, Ok shortPiece, Ok profile ), ( Ok rendering, Ok caseSideFlap ) ) -> Ok { shoulderWidth = shoulderWidth , longPiece = longPiece , shortPiece = shortPiece , caseSideFlap = caseSideFlap , paddingOffset = paddingOffset , topMargin = topMargin , rendering = rendering , profile = profile } ( ( shoulderWidth, paddingOffset ), ( longPiece, shortPiece, profile ), ( rendering, caseSideFlap ) ) -> ( ( shoulderWidth, paddingOffset, topMargin ), ( longPiece, shortPiece, profile ), ( rendering, caseSideFlap ) ) -> [ mkErrors [ ( ShoulderWidth, getError shoulderWidth ) , ( PaddingOffset, getError paddingOffset ) , ( TopMargin, getError topMargin ) , ( CaseSideFlap, getError caseSideFlap ) ] , unwrapErrors longPiece
-
-
-
@@ -41,7 +41,7 @@ cuts container params highlighting =(toMM params.rendering.gap) [ if toMM params.caseSideFlap > 0 then tailPiece { offset = 0 { offset = -(toMM params.topMargin) , highlighting = highlighting , parameters = params , renderFlap = True
-
@@ -53,7 +53,7 @@ cuts container params highlighting =empty , if toMM params.caseSideFlap > 0 || toMM params.shortPiece.buckleSideFlap > 0 then headPiece { offset = 0 { offset = -(toMM params.topMargin) , parameters = params , highlighting = highlighting , renderFlaps = True
-
@@ -249,13 +249,16 @@ tailPiece props =localId : String -> String localId body = tailPieceGraphicId props ++ "__" ++ body lineWidth = toMM parameters.rendering.lineWidth in { size = { width = Exactly (shoulderWidth - offset * 2) , height = Exactly (length - offset + flap) , height = Exactly (length - offset + flap - offset) } , element = \{ x, y } _ -> \{ x, y } size -> Svg.g [] [ defs
-
@@ -330,7 +333,44 @@ tailPiece props =, Svg.Attributes.mask ("url(#" ++ localId "mask" ++ ")") , fill "none" , stroke "currentColor" , strokeWidth (offset * 2 + toMM parameters.rendering.lineWidth * 2 |> String.fromFloat) , strokeWidth (offset * 2 + lineWidth * 2 |> String.fromFloat) ] [] ] else if offset < 0 then g [] [ Svg.mask [ id (localId "mask") , attribute "mask-type" "luminance" , Svg.Attributes.x (String.fromFloat -size.width) , Svg.Attributes.y (String.fromFloat -size.height) , width (String.fromFloat (size.width * 2)) , height (String.fromFloat (size.height * 2)) ] [ rect [ fill "white" , Svg.Attributes.x (String.fromFloat (x - size.width)) , Svg.Attributes.y (String.fromFloat (y - size.height)) , width (String.fromFloat (size.width * 3)) , height (String.fromFloat (size.height * 3)) ] [] , use [ attribute "href" ("#" ++ localId "body") , stroke "black" , strokeWidth (-offset * 2 |> String.fromFloat) , fill "black" ] [] ] , use [ attribute "href" ("#" ++ localId "body") , Svg.Attributes.mask ("url(#" ++ localId "mask" ++ ")") , fill "none" , stroke "currentColor" , strokeWidth (-offset * 2 + lineWidth * 2 |> String.fromFloat) ] [] ]
-
@@ -340,7 +380,7 @@ tailPiece props =[ attribute "href" ("#" ++ localId "body") , fill "none" , stroke "currentColor" , strokeWidth (toMM parameters.rendering.lineWidth |> String.fromFloat) , strokeWidth (String.fromFloat lineWidth) , highlightStroke (highlighting == Just LongPieceLength
-
@@ -375,8 +415,8 @@ tailPiece props =, if renderFlap then Svg.path (Path.d [ MoveTo Absolute ( x + offset, y + flap ) , HorizontalLineTo Relative shoulderWidth [ MoveTo Absolute ( x, y + flap ) , HorizontalLineTo Relative (shoulderWidth - offset * 2) ] :: guideStroke )
-
@@ -445,7 +485,7 @@ tailPiece props =hole parameters buckleHole.diameter ( x + shoulderWidth / 2 ( x + shoulderWidth / 2 - offset , y + flap + distance + interval * toFloat (index - parameters.longPiece.buckleHole.adjustments) ) [ highlightStroke
-
@@ -580,7 +620,7 @@ headPiece props =, height = Exactly (length + caseFlap + buckleFlap) } , element = \{ x, y } _ -> \{ x, y } size -> g [] [ defs []
-
@@ -628,6 +668,43 @@ headPiece props =[] ] else if offset < 0 then g [] [ Svg.mask [ id (localId "mask") , attribute "mask-type" "luminance" , Svg.Attributes.x (String.fromFloat -size.width) , Svg.Attributes.y (String.fromFloat -size.height) , width (String.fromFloat (size.width * 2)) , height (String.fromFloat (size.height * 2)) ] [ rect [ fill "white" , Svg.Attributes.x (String.fromFloat (x - size.width)) , Svg.Attributes.y (String.fromFloat (y - size.height)) , width (String.fromFloat (size.width * 3)) , height (String.fromFloat (size.height * 3)) ] [] , use [ attribute "href" ("#" ++ localId "body") , stroke "black" , strokeWidth (-offset * 2 |> String.fromFloat) , fill "black" ] [] ] , use [ attribute "href" ("#" ++ localId "body") , Svg.Attributes.mask ("url(#" ++ localId "mask" ++ ")") , fill "none" , stroke "currentColor" , strokeWidth (-offset * 2 + toMM parameters.rendering.lineWidth * 2 |> String.fromFloat) ] [] ] else use [ attribute "href" ("#" ++ localId "body")
-
@@ -671,7 +748,7 @@ headPiece props =[ Svg.path (Path.d [ MoveTo Absolute ( x, y + caseFlap ) , HorizontalLineTo Relative shoulderWidth , HorizontalLineTo Relative (shoulderWidth - offset * 2) ] :: guideStroke )
-