changeset 1327:e35de70f5295

browser: updated swiper and use a limit on version
author Goffi <goffi@goffi.org>
date Fri, 14 Aug 2020 09:31:32 +0200
parents 089742e065e3
children 683e50799d6d
files libervia/pages/_browser/browser_meta.json libervia/pages/_browser/slideshow.py
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/pages/_browser/browser_meta.json	Fri Aug 14 09:31:26 2020 +0200
+++ b/libervia/pages/_browser/browser_meta.json	Fri Aug 14 09:31:32 2020 +0200
@@ -3,14 +3,14 @@
         "package": {
             "dependencies": {
                 "nunjucks": "latest",
-                "swiper": "latest",
+                "swiper": "^6.1.1",
                 "moment": "latest"
             }
         },
         "brython_map": {
             "nunjucks": "nunjucks/browser/nunjucks.min.js",
             "swiper": {
-                "path": "swiper/js/swiper.min.js",
+                "path": "swiper/swiper-bundle.min.js",
                 "export": ["Swiper"]
             },
             "moment": "moment/min/moment.min.js"
--- a/libervia/pages/_browser/slideshow.py	Fri Aug 14 09:31:26 2020 +0200
+++ b/libervia/pages/_browser/slideshow.py	Fri Aug 14 09:31:32 2020 +0200
@@ -84,7 +84,7 @@
         self.swiper.on("slideChange", self.on_slide_change)
         self.swiper.on("click", self.on_click)
         self.swiper.on("doubleTap", self.on_double_tap)
-        self.on_slide_change()
+        self.on_slide_change(self.swiper)
         self.fullscreen(True)
 
     def add_slide(self, elt, item_data=None):
@@ -137,7 +137,7 @@
             return
         evt.preventDefault()
 
-    def on_slide_change(self):
+    def on_slide_change(self, swiper):
         item = self.current_item
         if item is None:
             return
@@ -153,14 +153,14 @@
             elt.style.display = '' if self.control_hidden else 'none'
         self.control_hidden = not self.control_hidden
 
-    def on_click(self, evt):
+    def on_click(self, swiper, evt):
         # we use a timer so double tap can cancel the click
         # this avoid double tap side effect
         if self.click_timer is None:
             self.click_timer = timer.set_timeout(
                 lambda: self.toggle_hide_controls(evt), 300)
 
-    def on_double_tap(self, evt):
+    def on_double_tap(self, swiper, evt):
         evt.stopPropagation()
         evt.preventDefault()
         if self.click_timer is not None: