wxyyxc1992 hace 5 años
padre
commit
66461864d0

+ 5
- 2
dist/cjs/board/Whiteboard/index.js Ver fichero

@@ -23,6 +23,7 @@ var Whiteboard = (function () {
23 23
         this.isFullscreen = false;
24 24
         this.pages = [];
25 25
         this.isInitialized = false;
26
+        this.isSyncing = false;
26 27
         this.visiblePageIndex = 0;
27 28
         if (target) {
28 29
             this.target = target;
@@ -207,10 +208,10 @@ var Whiteboard = (function () {
207 208
     Whiteboard.prototype.onSnapshot = function (snap) {
208 209
         var _this = this;
209 210
         var id = snap.id, sources = snap.sources, pageIds = snap.pageIds, visiblePageIndex = snap.visiblePageIndex;
210
-        if (!this.isInitialized) {
211
+        if (!this.isInitialized && !this.isSyncing) {
211 212
             this.id = id;
212 213
             this.sources = sources;
213
-            this.initSiema();
214
+            this.isSyncing = true;
214 215
             this.sources.forEach(function (source, i) {
215 216
                 var page = new index_1.WhitePage({ imgSrc: source }, {
216 217
                     mode: _this.mode,
@@ -222,8 +223,10 @@ var Whiteboard = (function () {
222 223
                 _this.pages.push(page);
223 224
                 page.open();
224 225
             });
226
+            this.initSiema();
225 227
         }
226 228
         this.isInitialized = true;
229
+        this.isSyncing = false;
227 230
         this.onPageChange(visiblePageIndex);
228 231
     };
229 232
     return Whiteboard;

+ 5
- 2
dist/index.js Ver fichero

@@ -1706,6 +1706,7 @@ var Whiteboard = function () {
1706 1706
         this.isFullscreen = false;
1707 1707
         this.pages = [];
1708 1708
         this.isInitialized = false;
1709
+        this.isSyncing = false;
1709 1710
         this.visiblePageIndex = 0;
1710 1711
         if (target) {
1711 1712
             this.target = target;
@@ -1893,10 +1894,10 @@ var Whiteboard = function () {
1893 1894
             sources = snap.sources,
1894 1895
             pageIds = snap.pageIds,
1895 1896
             visiblePageIndex = snap.visiblePageIndex;
1896
-        if (!this.isInitialized) {
1897
+        if (!this.isInitialized && !this.isSyncing) {
1897 1898
             this.id = id;
1898 1899
             this.sources = sources;
1899
-            this.initSiema();
1900
+            this.isSyncing = true;
1900 1901
             this.sources.forEach(function (source, i) {
1901 1902
                 var page = new index_1.WhitePage({ imgSrc: source }, {
1902 1903
                     mode: _this.mode,
@@ -1908,8 +1909,10 @@ var Whiteboard = function () {
1908 1909
                 _this.pages.push(page);
1909 1910
                 page.open();
1910 1911
             });
1912
+            this.initSiema();
1911 1913
         }
1912 1914
         this.isInitialized = true;
1915
+        this.isSyncing = false;
1913 1916
         this.onPageChange(visiblePageIndex);
1914 1917
     };
1915 1918
     return Whiteboard;

+ 1
- 1
dist/index.js.map
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 1
- 0
dist/types/board/Whiteboard/index.d.ts Ver fichero

@@ -21,6 +21,7 @@ export declare class Whiteboard {
21 21
     readonly activePage: WhitePage;
22 22
     siema: any;
23 23
     isInitialized: boolean;
24
+    isSyncing: boolean;
24 25
     visiblePageIndex: number;
25 26
     emitInterval: any;
26 27
     constructor(target: HTMLDivElement, { sources, eventHub, mode, visiblePageIndex }?: {

+ 6
- 2
src/board/Whiteboard/index.ts Ver fichero

@@ -49,6 +49,7 @@ export class Whiteboard {
49 49
   /** State | 内部状态 */
50 50
   // 是否被初始化过,如果尚未被初始化,则等待来自于 Master 的同步消息
51 51
   isInitialized: boolean = false;
52
+  isSyncing: boolean = false;
52 53
   visiblePageIndex: number = 0;
53 54
   emitInterval: any;
54 55
 
@@ -304,10 +305,10 @@ export class Whiteboard {
304 305
   private onSnapshot(snap: SerializableWhiteboard) {
305 306
     const { id, sources, pageIds, visiblePageIndex } = snap;
306 307
 
307
-    if (!this.isInitialized) {
308
+    if (!this.isInitialized && !this.isSyncing) {
308 309
       this.id = id;
309 310
       this.sources = sources;
310
-      this.initSiema();
311
+      this.isSyncing = true;
311 312
 
312 313
       // 初始化所有的 WhitePages
313 314
       this.sources.forEach((source, i) => {
@@ -328,9 +329,12 @@ export class Whiteboard {
328 329
 
329 330
         page.open();
330 331
       });
332
+
333
+      this.initSiema();
331 334
     }
332 335
 
333 336
     this.isInitialized = true;
337
+    this.isSyncing = false;
334 338
     this.onPageChange(visiblePageIndex);
335 339
   }
336 340
 }