فهرست منبع

improve annotation tool (allow styling via css and tailwind; fix type annotation)

Falko Schindler 3 سال پیش
والد
کامیت
1900e8b124
2فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 1 1
      nicegui/elements/annotation_tool.js
  2. 2 2
      nicegui/elements/annotation_tool.py

+ 1 - 1
nicegui/elements/annotation_tool.js

@@ -1,6 +1,6 @@
 Vue.component("annotation_tool", {
   template: `
-    <div :id="jp_props.id" style="position:relative;display:inline-block">
+    <div :id="jp_props.id" style="position:relative;display:inline-block" :style="jp_props.style" :class="jp_props.classes">
       <img style="max-width:100%">
       <svg style="position:absolute;top:0;left:0;pointer-events:none">
         <g style="display:none">

+ 2 - 2
nicegui/elements/annotation_tool.py

@@ -1,5 +1,5 @@
 from __future__ import annotations
-from typing import Callable, Optional
+from typing import Any, Callable, Dict, Optional
 import traceback
 from ..events import MouseEventArguments, handle_event
 from .custom_view import CustomView
@@ -29,7 +29,7 @@ class AnnotationTool(Element):
         self.mouse_handler = on_mouse
         super().__init__(AnnotationToolView(source, self.handle_mouse, events, cross))
 
-    def handle_mouse(self, msg):
+    def handle_mouse(self, msg: Dict[str, Any]):
         if self.mouse_handler is None:
             return
         try: