Mercurial > libervia-web
comparison libervia/pages/photos/album/_browser/__init__.py @ 1312:39a87d9099c4
browser (slideshow): slides can now be zoomed:
zoom is activated either by double clicking/taping or by pinching on touch devices
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 Aug 2020 16:47:24 +0200 |
parents | 7a4a92cf5b2b |
children | 0cbf86b1dcca |
comparison
equal
deleted
inserted
replaced
1311:9948598e7ec0 | 1312:39a87d9099c4 |
---|---|
1 from browser import document, window, bind, html, DOMNode | 1 from browser import document, window, bind, html, DOMNode |
2 from browser import aio | |
3 from browser import timer | |
4 from javascript import JSON | 2 from javascript import JSON |
5 from interpreter import Inspector | |
6 from bridge import Bridge | 3 from bridge import Bridge |
7 from template import Template | 4 from template import Template |
8 import dialog | 5 import dialog |
9 from slideshow import SlideShow | 6 from slideshow import SlideShow |
10 | 7 |
71 "thumb_url": url, | 68 "thumb_url": url, |
72 }, | 69 }, |
73 "uploading": True, | 70 "uploading": True, |
74 }) | 71 }) |
75 photo_elt.classList.add("progress_started") | 72 photo_elt.classList.add("progress_started") |
76 print(photo_elt.outerHTML) | |
77 album_items <= photo_elt | 73 album_items <= photo_elt |
78 # timer.set_timeout(lambda photo_elt=photo_elt: fake_finish(photo_elt), 5000) | |
79 | 74 |
80 bridge.fileHTTPUploadGetSlot( | 75 bridge.fileHTTPUploadGetSlot( |
81 file_.name, | 76 file_.name, |
82 file_.size, | 77 file_.size, |
83 file_.type or '', | 78 file_.type or '', |
158 evt.preventDefault() | 153 evt.preventDefault() |
159 slideshow = SlideShow() | 154 slideshow = SlideShow() |
160 target = evt.currentTarget | 155 target = evt.currentTarget |
161 clicked_item_elt = DOMNode(target.elt.closest('.item')) | 156 clicked_item_elt = DOMNode(target.elt.closest('.item')) |
162 | 157 |
163 select_idx = 0 | |
164 slideshow.attach() | 158 slideshow.attach() |
165 for idx, item_elt in enumerate(document.select('.item')): | 159 for idx, item_elt in enumerate(document.select('.item')): |
166 item = JSON.parse(item_elt.dataset.item) | 160 item = JSON.parse(item_elt.dataset.item) |
167 slide = html.DIV(Class="swiper-slide") | 161 slideshow.add_slide(html.IMG(src=item['url'], Class="slide_img"), item) |
168 img = html.IMG(src=item['url'], Class="slide_img") | |
169 slide <= img | |
170 slide._item = item | |
171 slideshow.add_slide(slide) | |
172 if item_elt == clicked_item_elt: | 162 if item_elt == clicked_item_elt: |
173 slideshow.index = idx | 163 slideshow.index = idx |
174 | 164 |
175 | 165 |
176 for elt in document.select('.action_delete'): | 166 for elt in document.select('.action_delete'): |