Loading src/webedit/slider/slider.cpp +19 −6 Changes for src/webedit/slider/slider.cpp: 19 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -358,7 +358,7 @@ extern "C" { // --- Slider container styles --- std::string style = "position: relative; overflow: hidden; touch-action: pan-y pinch-zoom;"; if (!width.empty()) style += " width: " + width + ";"; if (!height.empty()) style += " height: " + height + ";"; if (!height.empty()) style += " min-height: " + height + ";"; if (!backgroundColor.empty() && backgroundColor != "none") { style += " background-color: " + backgroundColor + ";"; } Loading @@ -373,8 +373,12 @@ extern "C" { wrapper.setAttribute("style", style.c_str()); // --- Slide track --- std::string trackStyle = "display: flex; height: 100%; touch-action: pan-y; flex-wrap: nowrap; will-change: transform;"; if (transition == "slide") { std::string trackStyle; if (transition == "fade") { // Grid stacking: all slides in same cell, tallest determines height trackStyle = "display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr; touch-action: pan-y;"; } else { trackStyle = "display: flex; height: 100%; touch-action: pan-y; flex-wrap: nowrap; will-change: transform;"; trackStyle += " transition: transform 0.5s ease-in-out;"; } Loading @@ -387,11 +391,15 @@ extern "C" { const EditPlugin *cur = child; while (cur) { libhtmlpp::HtmlElement slide("div"); std::string slideStyle = "width: 100%; flex: 0 0 100%; height: 100%; position: relative; overflow-x: hidden; overflow-y: auto; -webkit-user-drag: none; touch-action: pan-y; user-select: none; box-sizing: border-box;"; std::string slideStyle; if (transition == "fade") { slideStyle = "position: absolute; top: 0; left: 0; width: 100%; height: 100%;" // All slides stack in grid row 1 / col 1; tallest sets the height slideStyle = "grid-row: 1; grid-column: 1; width: 100%;" " opacity: 0; transition: opacity 0.5s ease-in-out;" " overflow-x: hidden; overflow-y: auto; -webkit-user-drag: none; touch-action: pan-y; user-select: none; box-sizing: border-box;"; " -webkit-user-drag: none; touch-action: pan-y; user-select: none; box-sizing: border-box;"; } else { slideStyle = "width: 100%; flex: 0 0 100%; height: 100%; position: relative;" " overflow-x: hidden; -webkit-user-drag: none; touch-action: pan-y; user-select: none; box-sizing: border-box;"; } slide.setAttribute("style", slideStyle.c_str()); slide.setAttribute("class", (cls + "-slide").c_str()); Loading Loading @@ -459,8 +467,13 @@ extern "C" { js << "var slides=el.querySelectorAll('." << cls << "-slide');"; js << "var dots=el.querySelectorAll('." << cls << "-dots button');"; js << "var n=slides.length,cur=0,timer=null;"; if (transition == "fade") { // Fade mode uses CSS grid stacking — no size override needed js << "function setSizes(){}"; } else { // Set slide widths in pixels for reliable mobile rendering js << "function setSizes(){var w=el.offsetWidth;for(var j=0;j<n;j++){slides[j].style.width=w+'px';slides[j].style.flex='0 0 '+w+'px';}}"; } js << "setSizes();"; js << "function show(i){"; js << " cur=((i%n)+n)%n;"; Loading Loading
src/webedit/slider/slider.cpp +19 −6 Changes for src/webedit/slider/slider.cpp: 19 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -358,7 +358,7 @@ extern "C" { // --- Slider container styles --- std::string style = "position: relative; overflow: hidden; touch-action: pan-y pinch-zoom;"; if (!width.empty()) style += " width: " + width + ";"; if (!height.empty()) style += " height: " + height + ";"; if (!height.empty()) style += " min-height: " + height + ";"; if (!backgroundColor.empty() && backgroundColor != "none") { style += " background-color: " + backgroundColor + ";"; } Loading @@ -373,8 +373,12 @@ extern "C" { wrapper.setAttribute("style", style.c_str()); // --- Slide track --- std::string trackStyle = "display: flex; height: 100%; touch-action: pan-y; flex-wrap: nowrap; will-change: transform;"; if (transition == "slide") { std::string trackStyle; if (transition == "fade") { // Grid stacking: all slides in same cell, tallest determines height trackStyle = "display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr; touch-action: pan-y;"; } else { trackStyle = "display: flex; height: 100%; touch-action: pan-y; flex-wrap: nowrap; will-change: transform;"; trackStyle += " transition: transform 0.5s ease-in-out;"; } Loading @@ -387,11 +391,15 @@ extern "C" { const EditPlugin *cur = child; while (cur) { libhtmlpp::HtmlElement slide("div"); std::string slideStyle = "width: 100%; flex: 0 0 100%; height: 100%; position: relative; overflow-x: hidden; overflow-y: auto; -webkit-user-drag: none; touch-action: pan-y; user-select: none; box-sizing: border-box;"; std::string slideStyle; if (transition == "fade") { slideStyle = "position: absolute; top: 0; left: 0; width: 100%; height: 100%;" // All slides stack in grid row 1 / col 1; tallest sets the height slideStyle = "grid-row: 1; grid-column: 1; width: 100%;" " opacity: 0; transition: opacity 0.5s ease-in-out;" " overflow-x: hidden; overflow-y: auto; -webkit-user-drag: none; touch-action: pan-y; user-select: none; box-sizing: border-box;"; " -webkit-user-drag: none; touch-action: pan-y; user-select: none; box-sizing: border-box;"; } else { slideStyle = "width: 100%; flex: 0 0 100%; height: 100%; position: relative;" " overflow-x: hidden; -webkit-user-drag: none; touch-action: pan-y; user-select: none; box-sizing: border-box;"; } slide.setAttribute("style", slideStyle.c_str()); slide.setAttribute("class", (cls + "-slide").c_str()); Loading Loading @@ -459,8 +467,13 @@ extern "C" { js << "var slides=el.querySelectorAll('." << cls << "-slide');"; js << "var dots=el.querySelectorAll('." << cls << "-dots button');"; js << "var n=slides.length,cur=0,timer=null;"; if (transition == "fade") { // Fade mode uses CSS grid stacking — no size override needed js << "function setSizes(){}"; } else { // Set slide widths in pixels for reliable mobile rendering js << "function setSizes(){var w=el.offsetWidth;for(var j=0;j<n;j++){slides[j].style.width=w+'px';slides[j].style.flex='0 0 '+w+'px';}}"; } js << "setSizes();"; js << "function show(i){"; js << " cur=((i%n)+n)%n;"; Loading