Commit e1275c07 authored by Jan Koester's avatar Jan Koester
Browse files

new option oval_inverted

parent 966f32ef
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -361,7 +361,7 @@ extern "C" {
                addField("direction", "Direction", "select", nullptr, "desktop", mkOpts({"vertical","horizontal"}));
                addField("align_items", "Align Items", "select", nullptr, "all",
                         mkOpts({"", "flex-start","center","flex-end","stretch","baseline"}));
                addField("shape_divider_type", "Shape Divider", "select", nullptr, "desktop", mkOpts({"none","wave","oval","banana"}), "simple");
                addField("shape_divider_type", "Shape Divider", "select", nullptr, "desktop", mkOpts({"none","wave","oval","oval_inverted","banana"}), "simple");
                addField("shape_divider_position", "Shape Divider Position", "select", nullptr, "desktop", mkOpts({"bottom","top","both"}), "simple");
                addField("shape_divider_color", "Shape Divider Color", "color_var", nullptr, "desktop", nullptr, "simple");
                addField("shape_divider_height", "Shape Divider Height", "text", "80px", "desktop");
@@ -1214,7 +1214,7 @@ extern "C" {
                    std::string css = shadowCss(boxShadow, boxShadowColor);
                    if (!css.empty()) style += " box-shadow: " + css + ";";
                }
                bool hasShapeDivider = (shapeDividerType == "wave" || shapeDividerType == "oval" || shapeDividerType == "banana");
                bool hasShapeDivider = (shapeDividerType == "wave" || shapeDividerType == "oval" || shapeDividerType == "oval_inverted" || shapeDividerType == "banana");
                if (hasShapeDivider) {
                    style += " position: relative;";
                }
@@ -1243,7 +1243,13 @@ extern "C" {
                        path = "M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,"
                               "512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34"
                               "C989.49,25,1113,44.11,1200,89.66V0Z";
                    } else if (shapeDividerType == "oval") {
                    } else if (shapeDividerType == "oval" || shapeDividerType == "oval_inverted") {
                        // Same curve for both -- "oval_inverted" is just "oval" with
                        // the fill side always swapped by default (see effectiveInvert
                        // below), giving a dedicated, directly-selectable "hill" preset
                        // (thin/low at the edges, tall in the middle) instead of the
                        // regular oval's "valley" look (tall at the edges, thin in the
                        // middle) without needing the separate invert checkbox.
                        path = "M0,0Q600,100,1200,0V120H0Z";
                    } else { // banana
                        path = "M0,90C200,10,500,10,700,50C900,90,1000,20,1200,40V120H0Z";
@@ -1271,7 +1277,11 @@ extern "C" {
                        svg.setAttribute("style", "display: block; width: 100%; height: 100%;");

                        libhtmlpp::HtmlElement svgPath("path");
                        if (shapeDividerFlip) {
                        // "oval_inverted" is inverted by default; the checkbox then
                        // toggles from there, so checking it on oval_inverted flips
                        // back to the plain oval look instead of stacking.
                        bool effectiveInvert = shapeDividerFlip != (shapeDividerType == "oval_inverted");
                        if (effectiveInvert) {
                            // "Invert" swaps which side of the curve is filled
                            // (convex bulge <-> concave notch) by adding a
                            // full-viewBox rectangle as a second subpath and