@netless/forge-slide 0.1.1-alpha.0 → 0.1.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/forge-slide",
3
- "version": "0.1.1-alpha.0",
3
+ "version": "0.1.1-alpha.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -48,6 +48,7 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
48
48
  private currentSlideIndex: number = 0;
49
49
  private taskId: string = "";
50
50
  private prefix: string = "";
51
+ private slideCount: number = 0;
51
52
 
52
53
  constructor() {
53
54
  super();
@@ -68,7 +69,7 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
68
69
  this.footer = new FooterView();
69
70
  this.sideBar = new SideBarView();
70
71
  this.sideBar.on("pageChange", index => {
71
- if (index > 0 && index <= this.slide.slideCount) {
72
+ if (index > 0 && index <= this.slideCount) {
72
73
  this.slide.renderSlide(index);
73
74
  }
74
75
  });
@@ -110,7 +111,7 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
110
111
  if (!this.permissions.hasPermission(ForgeSlidePermissionFlag.changePage)) {
111
112
  return;
112
113
  }
113
- if (this.currentSlideIndex < this.slide.slideCount) {
114
+ if (this.currentSlideIndex < this.slideCount) {
114
115
  this.slide.renderSlide(this.currentSlideIndex + 1);
115
116
  }
116
117
  });
@@ -128,10 +129,6 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
128
129
 
129
130
  this.rootView.appendChild(this.contentContainer);
130
131
 
131
- this.permissions.on("change", (userId, flags, value) => {
132
- this.emitter.emit("permissionChange", userId, flags, value);
133
- })
134
-
135
132
  this.emitter.on("renderStart", pageIndex => {
136
133
  this.footer.prevPageState(pageIndex !== 0);
137
134
  });
@@ -331,7 +328,7 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
331
328
  whiteboardApp.applicationManager = this.applicationManager;
332
329
 
333
330
  const json = await fetch(`${option.prefix}/${option.taskId}/jsonOutput/slide-1.json`).then(res => res.json())
334
-
331
+ this.slideCount = json.slideCount;
335
332
  await whiteboardApp.initialize({
336
333
  width: json.width,
337
334
  height: json.height,
@@ -420,15 +417,15 @@ export class SlideApplication extends AbstractApplication<SlideApplicationOption
420
417
 
421
418
  const syncSlide = this.getMap(this.name).get("slideState");
422
419
  if (syncSlide && syncSlide.taskId === option.taskId) {
423
- await this.slide.setSlideState(syncSlide)
420
+ this.slide.setSlideState(syncSlide)
424
421
  } else {
425
422
  this.slide.renderSlide(1);
426
423
  }
427
-
428
424
  this.permissions = new ForgeSlidePermissions(this.userManager, (userId: string) => {
429
425
  return this.userMap(userId);
430
426
  });
431
427
  this.permissions.on("change", (userId, flags, value) => {
428
+ this.emitter.emit("permissionChange", userId, flags, value);
432
429
  if (this.userId === userId) {
433
430
  if (flags.includes(ForgeSlidePermissionFlag.clickAnim)) {
434
431
  this.slideContainer.style.pointerEvents = "auto";