@netless/forge-slide 0.1.1-alpha.8 → 1.0.0-alpha.1
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/build.mjs +21 -21
- package/dist/FooterView.d.ts +13 -3
- package/dist/FooterView.d.ts.map +1 -1
- package/dist/ForgeSlidePermession.d.ts +7 -46
- package/dist/ForgeSlidePermession.d.ts.map +1 -1
- package/dist/SiderBarView.d.ts +19 -6
- package/dist/SiderBarView.d.ts.map +1 -1
- package/dist/Slide.d.ts +29 -30
- package/dist/Slide.d.ts.map +1 -1
- package/dist/SlideApplication.d.ts +11 -6
- package/dist/SlideApplication.d.ts.map +1 -1
- package/dist/SlidePool.d.ts +22 -0
- package/dist/SlidePool.d.ts.map +1 -0
- package/dist/icons.d.ts +1 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.esm.js +3719 -2502
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +3711 -2494
- package/dist/index.js.map +4 -4
- package/dist/utils.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/FooterView.ts +147 -93
- package/src/ForgeSlidePermession.ts +13 -120
- package/src/SiderBarView.ts +175 -94
- package/src/Slide.ts +29 -30
- package/src/SlideApplication.ts +535 -463
- package/src/SlidePool.ts +110 -0
- package/src/icons.ts +38 -19
- package/src/index.ts +4 -4
- package/src/utils.ts +43 -43
- package/dist/classes.d.ts +0 -3
- package/dist/classes.d.ts.map +0 -1
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,WAAW,GAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,WAAW,GAAE,MAAM,EAAmB,WAkD/E;AAWD,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAA8D"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/forge-slide",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@netless/slide": "^1.4.
|
|
10
|
-
"uuid": "^11.0.5",
|
|
11
|
-
"@netless/forge-room": "0.1.8",
|
|
12
|
-
"@netless/forge-whiteboard": "0.1.14"
|
|
9
|
+
"@netless/slide": "^1.4.21"
|
|
13
10
|
},
|
|
14
11
|
"peerDependencies": {
|
|
15
12
|
"eventemitter3": "^5.0.1",
|
|
16
13
|
"yjs": "^13.6.18",
|
|
17
|
-
"
|
|
14
|
+
"uuid": "^11.0.5",
|
|
15
|
+
"@netless/forge-room": "1.0.0-alpha.1",
|
|
16
|
+
"@netless/forge-whiteboard": "0.1.20-alpha.1"
|
|
18
17
|
},
|
|
19
18
|
"keywords": [],
|
|
20
19
|
"author": "",
|
|
21
20
|
"license": "ISC",
|
|
22
21
|
"scripts": {
|
|
23
22
|
"dev": "onChange 'src/**/*' -- npm run build",
|
|
24
|
-
"build": "tsc --emitDeclarationOnly && node build.mjs"
|
|
23
|
+
"build": "pnpm lint && tsc --emitDeclarationOnly && node build.mjs",
|
|
24
|
+
"lint": "eslint src"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/src/FooterView.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import EventEmitter from
|
|
2
|
-
import { Icons } from
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { Icons } from './icons';
|
|
3
3
|
|
|
4
4
|
interface FooterViewEvents {
|
|
5
5
|
prevPage: () => void;
|
|
@@ -9,102 +9,156 @@ interface FooterViewEvents {
|
|
|
9
9
|
sideBarToggle: () => void;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const EM_COLOR =
|
|
12
|
+
const EM_COLOR = '#8C8C8C';
|
|
13
13
|
|
|
14
14
|
export class FooterView extends EventEmitter<FooterViewEvents> {
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
private prevStep: HTMLDivElement;
|
|
19
|
-
private nextStep: HTMLDivElement;
|
|
20
|
-
|
|
21
|
-
private prevPage: HTMLDivElement;
|
|
22
|
-
private nextPage: HTMLDivElement;
|
|
23
|
-
|
|
24
|
-
private sideBarToggle: HTMLDivElement;
|
|
25
|
-
|
|
26
|
-
public constructor() {
|
|
27
|
-
super();
|
|
28
|
-
this.root = document.createElement("div");
|
|
29
|
-
this.root.classList.add("forge-slide-footer");
|
|
30
|
-
this.root.style.height = "24px";
|
|
31
|
-
this.root.style.zIndex = "6";
|
|
32
|
-
this.root.style.display = "flex";
|
|
33
|
-
this.root.style.alignItems = "center";
|
|
34
|
-
this.root.style.justifyContent = "center";
|
|
35
|
-
this.root.style.backgroundColor = "#fff";
|
|
36
|
-
|
|
37
|
-
this.prevStep = this.createIcon(Icons.prevStep(EM_COLOR), () => {
|
|
38
|
-
this.emit("prevStep");
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
this.nextStep = this.createIcon(Icons.nextStep(EM_COLOR), () => {
|
|
42
|
-
this.emit("nextStep");
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
this.prevPage = this.createIcon(Icons.prevPage(EM_COLOR), () => {
|
|
46
|
-
this.emit("prevPage");
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
this.nextPage = this.createIcon(Icons.nextPage(EM_COLOR), () => {
|
|
50
|
-
this.emit("nextPage");
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
this.sideBarToggle = this.createIcon(Icons.sideBar(EM_COLOR), () => {
|
|
54
|
-
this.emit("sideBarToggle")
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
this.root.appendChild(this.sideBarToggle);
|
|
58
|
-
this.root.appendChild(this.createSpacer());
|
|
59
|
-
this.root.appendChild(this.prevPage);
|
|
60
|
-
this.root.appendChild(this.prevStep);
|
|
61
|
-
this.root.appendChild(this.nextStep);
|
|
62
|
-
this.root.appendChild(this.nextPage);
|
|
63
|
-
this.root.appendChild(this.createSpacer());
|
|
64
|
-
}
|
|
16
|
+
public readonly root: HTMLDivElement;
|
|
65
17
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.prevPage.style.pointerEvents = "all";
|
|
69
|
-
this.prevPage.style.opacity = "1";
|
|
70
|
-
} else {
|
|
71
|
-
this.prevPage.style.pointerEvents = "none";
|
|
72
|
-
this.prevPage.style.opacity = "0.5";
|
|
73
|
-
}
|
|
74
|
-
}
|
|
18
|
+
private nextStep: HTMLDivElement;
|
|
19
|
+
private pauseIcon: HTMLDivElement;
|
|
75
20
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
this.nextPage.style.pointerEvents = "all";
|
|
79
|
-
this.nextPage.style.opacity = "1";
|
|
80
|
-
} else {
|
|
81
|
-
this.nextPage.style.pointerEvents = "none";
|
|
82
|
-
this.nextPage.style.opacity = "0.5";
|
|
83
|
-
}
|
|
84
|
-
}
|
|
21
|
+
private prevPage: HTMLDivElement;
|
|
22
|
+
private nextPage: HTMLDivElement;
|
|
85
23
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
24
|
+
private sideBarToggle: HTMLDivElement;
|
|
25
|
+
|
|
26
|
+
private currentPageIndex: number = 0;
|
|
27
|
+
private totalPageIndex: number = 0;
|
|
28
|
+
private pageIndexContainer: HTMLDivElement;
|
|
29
|
+
|
|
30
|
+
private eventMap: Map<HTMLDivElement, (() => void)[]> = new Map();
|
|
31
|
+
|
|
32
|
+
public constructor() {
|
|
33
|
+
super();
|
|
34
|
+
this.root = document.createElement('div');
|
|
35
|
+
this.root.classList.add('forge-slide-footer');
|
|
36
|
+
this.root.style.padding = '0 16px 0 0';
|
|
37
|
+
this.root.style.height = '24px';
|
|
38
|
+
this.root.style.zIndex = '6';
|
|
39
|
+
this.root.style.display = 'flex';
|
|
40
|
+
this.root.style.alignItems = 'center';
|
|
41
|
+
this.root.style.justifyContent = 'center';
|
|
42
|
+
this.root.style.backgroundColor = '#fff';
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
this.prevPage = this.createIcon(Icons.prevPage(EM_COLOR), () => {
|
|
46
|
+
this.emit('prevPage');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
this.nextStep = this.createIcon(Icons.nextStep(EM_COLOR), () => {
|
|
50
|
+
this.emit('nextStep');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
this.pauseIcon = this.createIcon(Icons.pause(EM_COLOR), () => {
|
|
91
54
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
55
|
+
});
|
|
56
|
+
this.pauseIcon.style.display = 'none';
|
|
57
|
+
|
|
58
|
+
this.nextPage = this.createIcon(Icons.nextPage(EM_COLOR), () => {
|
|
59
|
+
this.emit('nextPage');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
this.sideBarToggle = this.createIcon(Icons.sideBar(EM_COLOR), () => {
|
|
63
|
+
this.emit('sideBarToggle');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
this.pageIndexContainer = this.createPageNumber();
|
|
68
|
+
|
|
69
|
+
this.root.appendChild(this.sideBarToggle);
|
|
70
|
+
this.root.appendChild(this.createSpacer());
|
|
71
|
+
this.root.appendChild(this.prevPage);
|
|
72
|
+
this.root.appendChild(this.nextStep);
|
|
73
|
+
this.root.appendChild(this.pauseIcon);
|
|
74
|
+
this.root.appendChild(this.nextPage);
|
|
75
|
+
this.root.appendChild(this.createSpacer());
|
|
76
|
+
this.root.appendChild(this.pageIndexContainer);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public changeIconToPause(): void {
|
|
80
|
+
this.nextStep.style.display = 'none';
|
|
81
|
+
this.pauseIcon.style.display = 'block';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public changeIconToNextStep(): void {
|
|
85
|
+
this.nextStep.style.display = 'block';
|
|
86
|
+
this.pauseIcon.style.display = 'none';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public setCurrentPageIndex(index: number): void {
|
|
90
|
+
this.currentPageIndex = index;
|
|
91
|
+
this.pageIndexContainer.textContent = `${this.currentPageIndex} / ${this.totalPageIndex}`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public setTotalPageIndex(count: number): void {
|
|
95
|
+
this.totalPageIndex = count;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public prevPageState(enable: boolean): void {
|
|
99
|
+
if (enable) {
|
|
100
|
+
this.prevPage.style.pointerEvents = 'all';
|
|
101
|
+
this.prevPage.style.opacity = '1';
|
|
102
|
+
} else {
|
|
103
|
+
this.prevPage.style.pointerEvents = 'none';
|
|
104
|
+
this.prevPage.style.opacity = '0.5';
|
|
109
105
|
}
|
|
110
|
-
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private createSpacer(): HTMLDivElement {
|
|
109
|
+
const div = document.createElement('div');
|
|
110
|
+
div.style.flex = '1 1 auto';
|
|
111
|
+
return div;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private createPageNumber(): HTMLDivElement {
|
|
115
|
+
const div = document.createElement('div');
|
|
116
|
+
div.style.fontSize = '13px';
|
|
117
|
+
div.style.margin = '6px';
|
|
118
|
+
div.style.color = '#191919';
|
|
119
|
+
div.style.fontFamily = 'system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"';
|
|
120
|
+
div.style.fontWeight = '400';
|
|
121
|
+
div.style.lineHeight = '18px';
|
|
122
|
+
div.style.userSelect = 'none';
|
|
123
|
+
return div;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private createIcon(svgContent: string, action: () => void): HTMLDivElement {
|
|
127
|
+
const icon = document.createElement('div');
|
|
128
|
+
icon.style.width = '18px';
|
|
129
|
+
icon.style.height = '18px';
|
|
130
|
+
icon.style.borderRadius = '2px';
|
|
131
|
+
icon.style.margin = '6px';
|
|
132
|
+
icon.innerHTML = svgContent;
|
|
133
|
+
const onClickHandle = () => {
|
|
134
|
+
action();
|
|
135
|
+
};
|
|
136
|
+
const onMouseOverHandle = () => {
|
|
137
|
+
icon.style.backgroundColor = '#f0f0f0';
|
|
138
|
+
};
|
|
139
|
+
const onMouseOutHandle = () => {
|
|
140
|
+
icon.style.backgroundColor = 'transparent';
|
|
141
|
+
};
|
|
142
|
+
icon.addEventListener('click', onClickHandle);
|
|
143
|
+
icon.addEventListener('mouseover', onMouseOverHandle);
|
|
144
|
+
icon.addEventListener('mouseout', onMouseOutHandle);
|
|
145
|
+
this.eventMap.set(icon, [onClickHandle, onMouseOutHandle, onMouseOverHandle]);
|
|
146
|
+
return icon;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
private clearHTMLEventListeners() {
|
|
150
|
+
this.eventMap.forEach((value, key) => {
|
|
151
|
+
if (key) {
|
|
152
|
+
const [clickEvent, mouseOutEvent, mouseOverEvent] = value;
|
|
153
|
+
key.removeEventListener('click', clickEvent);
|
|
154
|
+
key.removeEventListener('mouseover', mouseOverEvent);
|
|
155
|
+
key.removeEventListener('mouseout', mouseOutEvent);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
dispose() {
|
|
161
|
+
this.removeAllListeners();
|
|
162
|
+
this.clearHTMLEventListeners();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import EventEmitter from "eventemitter3";
|
|
3
|
-
import * as Y from "yjs";
|
|
1
|
+
import { AbstractApplicationPermissions, ApplicationPermissionEvents } from '@netless/forge-room';
|
|
4
2
|
|
|
5
3
|
export enum ForgeSlidePermissionFlag {
|
|
6
4
|
/**
|
|
@@ -27,7 +25,7 @@ export enum ForgeSlidePermissionFlag {
|
|
|
27
25
|
ForgeSlidePermissionFlag.clickAnim
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
export interface ForgeSlidePermissionEvents {
|
|
28
|
+
export interface ForgeSlidePermissionEvents extends ApplicationPermissionEvents {
|
|
31
29
|
/**
|
|
32
30
|
* 当用户权限变更时触发
|
|
33
31
|
* @param { string } userId 对应 userId
|
|
@@ -37,123 +35,18 @@ export interface ForgeSlidePermissionEvents {
|
|
|
37
35
|
change: (userId: string, flags: ForgeSlidePermissionFlag[], value: number) => void;
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
export class ForgeSlidePermissions extends
|
|
41
|
-
|
|
42
|
-
private requestUserMap: (userId: string) => Y.Map<any>;
|
|
43
|
-
private userManager: UserManager;
|
|
44
|
-
private observers: Map<string, any> = new Map();
|
|
45
|
-
|
|
46
|
-
public constructor(
|
|
47
|
-
userManager: UserManager,
|
|
48
|
-
requestUserMap: (userId: string) => Y.Map<any>,
|
|
49
|
-
) {
|
|
50
|
-
super();
|
|
51
|
-
this.userManager = userManager;
|
|
52
|
-
this.requestUserMap = requestUserMap;
|
|
53
|
-
this.createModel(this.userManager.selfId);
|
|
54
|
-
this.userManager.userIdList().forEach((userId) => {
|
|
55
|
-
this.addObserve(userId);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
this.userManager.on("join", this.handleUserJoin);
|
|
59
|
-
this.userManager.on("leave", this.handleUserLeave);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
private handleUserLeave = (user: RoomUser) => {
|
|
63
|
-
const cb = this.observers.get(user.id);
|
|
64
|
-
if (cb) {
|
|
65
|
-
this.requestUserMap(user.id).unobserve(cb);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
private handleUserJoin = (user: RoomUser) => {
|
|
70
|
-
this.addObserve(user.id);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
private addObserve(userId: string) {
|
|
74
|
-
const observer = (evt: Y.YMapEvent<any>) => {
|
|
75
|
-
this.handleUserPermissionChange(userId, evt);
|
|
76
|
-
};
|
|
77
|
-
this.observers.set(userId, observer);
|
|
78
|
-
this.requestUserMap(userId).observe(observer)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
private createModel(userId: string) {
|
|
82
|
-
const userMap = this.requestUserMap(userId);
|
|
83
|
-
if (!userMap.has("permission")) {
|
|
84
|
-
userMap.set("permission", 0);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private handleUserPermissionChange(userId: string, evt: Y.YMapEvent<any>) {
|
|
89
|
-
for (const [key, value] of evt.changes.keys.entries()) {
|
|
90
|
-
if (key === "permission") {
|
|
91
|
-
if (value.action === "add" || value.action === "update") {
|
|
92
|
-
const newValue = this.requestUserMap(userId).get("permission");
|
|
93
|
-
this.emit("change", userId, this.resolveFlags(newValue), newValue);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
38
|
+
export class ForgeSlidePermissions extends AbstractApplicationPermissions<ForgeSlidePermissionFlag, ForgeSlidePermissionEvents> {
|
|
39
|
+
/**
|
|
100
40
|
* 解析权限列表组合
|
|
101
41
|
* @param {number} value - 权限数字值
|
|
102
42
|
* @return {WhiteboardPermissionFlag[]} - 权限列表
|
|
103
43
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
* 获取权限列表组合对应的数值
|
|
114
|
-
* @param { string } userId 不传表示获取自己
|
|
115
|
-
*/
|
|
116
|
-
public getPermissionValue(userId?: string): number {
|
|
117
|
-
return this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* 获取权限列表
|
|
122
|
-
* @param {string=} userId 可选, 不传表示获取自己
|
|
123
|
-
*/
|
|
124
|
-
public getPermissionFlags(userId?: string): ForgeSlidePermissionFlag[] {
|
|
125
|
-
const value = this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
126
|
-
return this.resolveFlags(value);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* 返回对应 userId 是否有相应权限
|
|
131
|
-
* @param {string=} userId 可选, 不传表示返回自己是否有相应权限
|
|
132
|
-
* @param {WhiteboardPermissionFlag} flag
|
|
133
|
-
*/
|
|
134
|
-
public hasPermission(flag: ForgeSlidePermissionFlag, userId?: string): boolean {
|
|
135
|
-
return ((this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0) & flag) !== 0;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* 添加权限
|
|
140
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
141
|
-
* @param {string=} userId 可选, 为 userId 添加权限, 不传表示为自己添加权限
|
|
142
|
-
*/
|
|
143
|
-
public addPermission(flag: ForgeSlidePermissionFlag, userId?: string) {
|
|
144
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
145
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
146
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue | flag);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* 移除权限
|
|
151
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
152
|
-
* @param {string=} userId 可选, 为 userId 移除权限, 不传表示为自己移除权限
|
|
153
|
-
*/
|
|
154
|
-
public removePermission(flag: ForgeSlidePermissionFlag, userId?: string) {
|
|
155
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
156
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
157
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue & (~flag));
|
|
158
|
-
}
|
|
159
|
-
}
|
|
44
|
+
public resolveFlags(value: number): ForgeSlidePermissionFlag[] {
|
|
45
|
+
return [
|
|
46
|
+
ForgeSlidePermissionFlag.changePage,
|
|
47
|
+
ForgeSlidePermissionFlag.changeStep,
|
|
48
|
+
ForgeSlidePermissionFlag.clickAnim,
|
|
49
|
+
].filter(v => (v & value) !== 0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|