Jelajahi Sumber

fix overlay on large images

Falko Schindler 3 tahun lalu
induk
melakukan
13a67d6b5b
2 mengubah file dengan 3 tambahan dan 4 penghapusan
  1. 2 3
      main.py
  2. 1 1
      nicegui/elements/svg.py

+ 2 - 3
main.py

@@ -162,10 +162,9 @@ with example(overlay):
 
     with ui.image('https://cdn.pixabay.com/photo/2020/07/13/12/56/mute-swan-5400675__340.jpg'):
         svg_content = '''
-            <svg viewBox="0 0 510 340" width="100%"  height="100%" xmlns="http://www.w3.org/2000/svg">
+            <svg viewBox="0 0 510 340" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
             <circle cx="200" cy="200" r="100" fill="none" stroke="red" stroke-width="10" />
-            </svg>
-            '''
+            </svg>'''
         ui.svg(svg_content).style('background:transparent')
 
 with example(ui.markdown):

+ 1 - 1
nicegui/elements/svg.py

@@ -14,7 +14,7 @@ class Svg(Element):
         :param content: the svg definition
         """
 
-        view = jp.Div(style="padding:0")
+        view = jp.Div(style="padding:0;width:100%;height:100%")
         super().__init__(view)
         self.content = content