Quellcode durchsuchen

feat: update whiteboard

wxyyxc1992 vor 5 Jahren
Ursprung
Commit
17224f23b0

+ 2
- 2
dist/cjs/board/Drawboard/index.js Datei anzeigen

@@ -46,7 +46,7 @@ var Drawboard = (function (_super) {
46 46
             if (_this.source.imgSrc) {
47 47
                 _this.target.style.display = 'none';
48 48
             }
49
-            _this.boardHolder.style.opacity = '0';
49
+            _this.boardHolder.style.visibility = 'hidden';
50 50
             _this.boardHolder.style.zIndex = '-1';
51 51
             if (_this.toolbar) {
52 52
                 _this.toolbar.hide();
@@ -56,7 +56,7 @@ var Drawboard = (function (_super) {
56 56
             if (_this.source.imgSrc) {
57 57
                 _this.target.style.display = 'block';
58 58
             }
59
-            _this.boardHolder.style.opacity = '1';
59
+            _this.boardHolder.style.opacity = 'visible';
60 60
             _this.boardHolder.style.zIndex = '9999';
61 61
             if (_this.toolbar) {
62 62
                 _this.toolbar.show();

+ 15
- 2
dist/cjs/board/Whiteboard/index.js Datei anzeigen

@@ -47,6 +47,13 @@ var Whiteboard = (function () {
47 47
         }
48 48
         this.init();
49 49
     }
50
+    Object.defineProperty(Whiteboard.prototype, "activePage", {
51
+        get: function () {
52
+            return this.pages[this.visiblePageIndex];
53
+        },
54
+        enumerable: true,
55
+        configurable: true
56
+    });
50 57
     Whiteboard.prototype.open = function () {
51 58
         var _this = this;
52 59
         this.pages.forEach(function (page, i) {
@@ -61,6 +68,12 @@ var Whiteboard = (function () {
61 68
             clearInterval(this.emitInterval);
62 69
         }
63 70
     };
71
+    Whiteboard.prototype.show = function () {
72
+        this.activePage.show();
73
+    };
74
+    Whiteboard.prototype.hide = function () {
75
+        this.activePage.hide();
76
+    };
64 77
     Whiteboard.prototype.snap = function () {
65 78
         return {
66 79
             id: this.id,
@@ -88,7 +101,7 @@ var Whiteboard = (function () {
88 101
                 eventHub: _this.eventHub,
89 102
                 parentContainer: _this.pagesContainer
90 103
             });
91
-            page.container.style.opacity = '0';
104
+            page.container.style.visibility = 'hidden';
92 105
             _this.pages.push(page);
93 106
         });
94 107
         this.initSiema();
@@ -201,7 +214,7 @@ var Whiteboard = (function () {
201 214
                     parentContainer: _this.pagesContainer
202 215
                 });
203 216
                 page.id = pageIds[i];
204
-                page.container.style.opacity = '0';
217
+                page.container.style.opacity = 'hidden';
205 218
                 _this.pages.push(page);
206 219
                 page.open();
207 220
             });

+ 2
- 2
dist/cjs/toolbar/Toolbar.js Datei anzeigen

@@ -21,11 +21,11 @@ var Toolbar = (function () {
21 21
         this.clickHandler = clickHandler;
22 22
     }
23 23
     Toolbar.prototype.hide = function () {
24
-        this.toolbarUI.style.opacity = '0';
24
+        this.toolbarUI.style.visibility = 'hidden';
25 25
         this.toolbarUI.style.zIndex = '-1';
26 26
     };
27 27
     Toolbar.prototype.show = function () {
28
-        this.toolbarUI.style.opacity = '1';
28
+        this.toolbarUI.style.visibility = 'visible';
29 29
         this.toolbarUI.style.zIndex = '999';
30 30
     };
31 31
     return Toolbar;

+ 1
- 1
dist/index.js
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 3
- 0
dist/types/board/Whiteboard/index.d.ts Datei anzeigen

@@ -18,6 +18,7 @@ export declare class Whiteboard {
18 18
     mode: WhiteboardMode;
19 19
     isFullscreen: boolean;
20 20
     pages: WhitePage[];
21
+    readonly activePage: WhitePage;
21 22
     siema: any;
22 23
     isInitialized: boolean;
23 24
     visiblePageIndex: number;
@@ -30,6 +31,8 @@ export declare class Whiteboard {
30 31
     });
31 32
     open(): void;
32 33
     close(): void;
34
+    show(): void;
35
+    hide(): void;
33 36
     snap(): SerializableWhiteboard;
34 37
     private init;
35 38
     private initMaster;

+ 2
- 2
src/board/Drawboard/index.ts Datei anzeigen

@@ -85,7 +85,7 @@ export class Drawboard extends Baseboard {
85 85
       this.target.style.display = 'none';
86 86
     }
87 87
     // 这里不使用 display:none,是为了保证在隐藏时候仍然可以执行更新
88
-    this.boardHolder.style.opacity = '0';
88
+    this.boardHolder.style.visibility = 'hidden';
89 89
     this.boardHolder.style.zIndex = '-1';
90 90
 
91 91
     if (this.toolbar) {
@@ -98,7 +98,7 @@ export class Drawboard extends Baseboard {
98 98
       this.target.style.display = 'block';
99 99
     }
100 100
 
101
-    this.boardHolder.style.opacity = '1';
101
+    this.boardHolder.style.opacity = 'visible';
102 102
     this.boardHolder.style.zIndex = '9999';
103 103
 
104 104
     if (this.toolbar) {

+ 14
- 2
src/board/Whiteboard/index.ts Datei anzeigen

@@ -41,6 +41,9 @@ export class Whiteboard {
41 41
 
42 42
   /** 句柄 */
43 43
   pages: WhitePage[] = [];
44
+  get activePage() {
45
+    return this.pages[this.visiblePageIndex];
46
+  }
44 47
   siema: any;
45 48
 
46 49
   /** State | 内部状态 */
@@ -113,6 +116,15 @@ export class Whiteboard {
113 116
     }
114 117
   }
115 118
 
119
+  /** 展示当前的 WhitePage */
120
+  public show() {
121
+    this.activePage.show();
122
+  }
123
+
124
+  public hide() {
125
+    this.activePage.hide();
126
+  }
127
+
116 128
   /** 获取当前快照 */
117 129
   public snap(): SerializableWhiteboard {
118 130
     return {
@@ -155,7 +167,7 @@ export class Whiteboard {
155 167
       );
156 168
 
157 169
       // 这里隐藏 Dashboard 的图片源,Siema 切换的是占位图片
158
-      page.container.style.opacity = '0';
170
+      page.container.style.visibility = 'hidden';
159 171
 
160 172
       this.pages.push(page);
161 173
     });
@@ -306,7 +318,7 @@ export class Whiteboard {
306 318
         page.id = pageIds[i];
307 319
 
308 320
         // 这里隐藏 Dashboard 的图片源,Siema 切换的是占位图片
309
-        page.container.style.opacity = '0';
321
+        page.container.style.opacity = 'hidden';
310 322
 
311 323
         this.pages.push(page);
312 324
 

+ 2
- 2
src/toolbar/Toolbar.ts Datei anzeigen

@@ -33,12 +33,12 @@ export class Toolbar {
33 33
   };
34 34
 
35 35
   public hide() {
36
-    this.toolbarUI.style.opacity = '0';
36
+    this.toolbarUI.style.visibility = 'hidden';
37 37
     this.toolbarUI.style.zIndex = '-1';
38 38
   }
39 39
 
40 40
   public show() {
41
-    this.toolbarUI.style.opacity = '1';
41
+    this.toolbarUI.style.visibility = 'visible';
42 42
     this.toolbarUI.style.zIndex = '999';
43 43
   }
44 44
 }