Commit 71cc5a73 authored by jan.koester's avatar jan.koester
Browse files

test mobile

parent 53792e62
Loading
Loading
Loading
Loading
+5 −4
Changes for src/webedit/slider/slider.cpp: 5 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ extern "C" {
                wrapper.setAttribute("style", style.c_str());

                // --- Slide track ---
                std::string trackStyle = "display: flex; height: 100%;";
                std::string trackStyle = "display: flex; height: 100%; touch-action: pan-y;";
                if (transition == "slide") {
                    trackStyle += " transition: transform 0.5s ease-in-out;";
                }
@@ -387,11 +387,11 @@ extern "C" {
                const EditPlugin *cur = child;
                while (cur) {
                    libhtmlpp::HtmlElement slide("div");
                    std::string slideStyle = "min-width: 100%; height: 100%; flex-shrink: 0; position: relative; overflow: hidden; -webkit-user-drag: none;";
                    std::string slideStyle = "min-width: 100%; height: 100%; flex-shrink: 0; position: relative; overflow: hidden; -webkit-user-drag: none; touch-action: pan-y; user-select: none;";
                    if (transition == "fade") {
                        slideStyle = "position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
                                     " opacity: 0; transition: opacity 0.5s ease-in-out;"
                                     " overflow: hidden; -webkit-user-drag: none;";
                                     " overflow: hidden; -webkit-user-drag: none; touch-action: pan-y; user-select: none;";
                    }
                    slide.setAttribute("style", slideStyle.c_str());
                    slide.setAttribute("class", (cls + "-slide").c_str());
@@ -483,7 +483,7 @@ extern "C" {
                        js << "startAuto();";
                    }
                    // Touch/swipe support for mobile
                    js << "el.querySelectorAll('img,video').forEach(function(m){m.draggable=false;m.style.webkitUserDrag='none';m.style.userSelect='none';});";
                    js << "el.querySelectorAll('img,video,a,div,span,p,h1,h2,h3,h4,button').forEach(function(m){m.style.touchAction='pan-y';m.draggable=false;m.style.webkitUserDrag='none';m.style.userSelect='none';});";
                    js << "var tx=0,ty=0,moving=false;";
                    js << "el.addEventListener('touchstart',function(e){";
                    js << "  tx=e.touches[0].clientX;ty=e.touches[0].clientY;moving=true;";
@@ -502,6 +502,7 @@ extern "C" {
                    js << "    if(timer){clearInterval(timer);startAuto();}";
                    js << "  }";
                    js << "},{passive:true});";
                    js << "el.addEventListener('touchcancel',function(){moving=false;},{passive:true});";
                    js << "el._blogiSlider={next:next,prev:prev,goTo:goTo};";
                    js << "})();";
                    script.appendChild(libhtmlpp::TextElement(js.str().c_str()));