@netless/window-manager 1.0.0-canary.57 → 1.0.0-canary.58
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/dist/{index.cjs.js → index.js} +1920 -1266
- package/dist/{index.es.js → index.mjs} +1918 -1247
- package/dist/index.umd.js +1912 -1258
- package/dist/src/View/ViewSync.d.ts +2 -1
- package/dist/src/index.d.ts +4 -0
- package/dist/src/typings.d.ts +1 -1
- package/dist/style.css +14 -0
- package/package.json +6 -6
- package/pnpm-lock.yaml +161 -129
- package/src/App/AppProxy.ts +1 -1
- package/src/Cursor/Cursor.svelte +6 -2
- package/src/Cursor/Cursor.ts +9 -2
- package/src/Cursor/icons.ts +6 -0
- package/src/View/ScrollMode.ts +4 -3
- package/src/View/ViewSync.ts +4 -1
- package/src/image/pencil-eraser-1.svg +3 -0
- package/src/image/pencil-eraser-2.svg +3 -0
- package/src/image/pencil-eraser-3.svg +3 -0
- package/src/index.ts +11 -0
- package/src/style.css +14 -0
- package/src/typings.ts +1 -1
package/src/Cursor/Cursor.ts
CHANGED
@@ -157,14 +157,21 @@ export class Cursor {
|
|
157
157
|
cursorTagBackgroundColor: this.memberCursorTagBackgroundColor,
|
158
158
|
opacity: this.memberOpacity,
|
159
159
|
tagName: this.memberTagName,
|
160
|
+
pencilEraserSize: this.member?.memberState.pencilEraserSize,
|
160
161
|
};
|
161
162
|
}
|
162
163
|
|
163
164
|
private getIcon() {
|
164
165
|
if (this.member) {
|
165
166
|
const icons = this.cursorManager.applianceIcons;
|
166
|
-
|
167
|
-
|
167
|
+
let applianceSrc = icons[ApplianceNames.shape];
|
168
|
+
if (this.memberApplianceName === ApplianceNames.pencilEraser) {
|
169
|
+
const size = this.member?.memberState.pencilEraserSize || 1;
|
170
|
+
applianceSrc = icons[`${this.memberApplianceName}${size}`];
|
171
|
+
} else {
|
172
|
+
applianceSrc = icons[this.memberApplianceName || ApplianceNames.shape];
|
173
|
+
}
|
174
|
+
return applianceSrc;
|
168
175
|
}
|
169
176
|
}
|
170
177
|
|
package/src/Cursor/icons.ts
CHANGED
@@ -5,6 +5,9 @@ import eraser from "../image/eraser-cursor.png";
|
|
5
5
|
import shape from "../image/shape-cursor.svg";
|
6
6
|
import text from "../image/text-cursor.svg";
|
7
7
|
import laser from "../image/laser-pointer-cursor.svg";
|
8
|
+
import pencilEraser1 from "../image/pencil-eraser-1.svg";
|
9
|
+
import pencilEraser2 from "../image/pencil-eraser-2.svg";
|
10
|
+
import pencilEraser3 from "../image/pencil-eraser-3.svg";
|
8
11
|
|
9
12
|
export const ApplianceMap: {
|
10
13
|
[key: string]: string;
|
@@ -15,4 +18,7 @@ export const ApplianceMap: {
|
|
15
18
|
[ApplianceNames.shape]: shape,
|
16
19
|
[ApplianceNames.text]: text,
|
17
20
|
[ApplianceNames.laserPointer]: laser,
|
21
|
+
["pencilEraser1"]: pencilEraser1,
|
22
|
+
["pencilEraser2"]: pencilEraser2,
|
23
|
+
["pencilEraser3"]: pencilEraser3,
|
18
24
|
};
|
package/src/View/ScrollMode.ts
CHANGED
@@ -4,6 +4,7 @@ import { combine, derive, Val } from "value-enhancer";
|
|
4
4
|
import { createScrollStorage } from "../storage";
|
5
5
|
import { SCROLL_MODE_BASE_HEIGHT, SCROLL_MODE_BASE_WIDTH } from "../constants";
|
6
6
|
import { SideEffectManager } from "side-effect-manager";
|
7
|
+
import { round } from "lodash";
|
7
8
|
import type { ReadonlyVal } from "value-enhancer";
|
8
9
|
import type { AppManager } from "../AppManager";
|
9
10
|
import type { ScrollStorage } from "../storage";
|
@@ -138,9 +139,9 @@ export class ScrollMode {
|
|
138
139
|
[this._scrollTop$, this._page$, maxScrollPage$],
|
139
140
|
([scrollTop, page, maxScrollPage]) => {
|
140
141
|
return {
|
141
|
-
scrollTop,
|
142
|
-
page,
|
143
|
-
maxScrollPage,
|
142
|
+
scrollTop: round(scrollTop, 2),
|
143
|
+
page: round(page, 2),
|
144
|
+
maxScrollPage: round(maxScrollPage, 2),
|
144
145
|
};
|
145
146
|
}
|
146
147
|
);
|
package/src/View/ViewSync.ts
CHANGED
@@ -3,8 +3,9 @@ import { CameraSynchronizer } from "./CameraSynchronizer";
|
|
3
3
|
import { combine, derive } from "value-enhancer";
|
4
4
|
import { isEqual } from "lodash";
|
5
5
|
import { SideEffectManager } from "side-effect-manager";
|
6
|
+
import { Val } from "value-enhancer";
|
6
7
|
import type { Camera, View } from "white-web-sdk";
|
7
|
-
import type {
|
8
|
+
import type { ReadonlyVal } from "value-enhancer";
|
8
9
|
import type { ICamera, ISize } from "../AttributesDelegate";
|
9
10
|
import type { TeleBoxRect } from "@netless/telebox-insider";
|
10
11
|
import type { ManagerViewMode } from "../typings";
|
@@ -43,6 +44,8 @@ export class ViewSync {
|
|
43
44
|
]);
|
44
45
|
if (context.viewMode$) {
|
45
46
|
this.needRecoverCamera$ = derive(context.viewMode$, mode => mode !== "scroll");
|
47
|
+
} else {
|
48
|
+
this.needRecoverCamera$ = new Val(true);
|
46
49
|
}
|
47
50
|
const camera$size$ = combine([this.context.camera$, this.context.size$]);
|
48
51
|
camera$size$.reaction(([camera, size]) => {
|
package/src/index.ts
CHANGED
@@ -1019,6 +1019,17 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
|
|
1019
1019
|
});
|
1020
1020
|
}, 500);
|
1021
1021
|
}
|
1022
|
+
/**
|
1023
|
+
* 切换 focus 到指定的 app, 并且把这个 app 放到最前面
|
1024
|
+
*/
|
1025
|
+
public focusApp(appId: string) {
|
1026
|
+
const box = this.boxManager?.getBox(appId);
|
1027
|
+
if (box) {
|
1028
|
+
this.boxManager?.focusBox({ appId }, false);
|
1029
|
+
// 1.0 版本这里会有正式的 api
|
1030
|
+
(this.boxManager?.teleBoxManager as any).makeBoxTop(box, false);
|
1031
|
+
}
|
1032
|
+
}
|
1022
1033
|
|
1023
1034
|
public createPPTHandler() {
|
1024
1035
|
return {
|
package/src/style.css
CHANGED
@@ -119,6 +119,20 @@
|
|
119
119
|
margin-top: 3px;
|
120
120
|
}
|
121
121
|
|
122
|
+
.netless-window-manager-cursor-pencilEraser-image {
|
123
|
+
margin-left: -22px;
|
124
|
+
margin-top: 3px;
|
125
|
+
}
|
126
|
+
|
127
|
+
.netless-window-manager-laserPointer-pencilEraser-offset {
|
128
|
+
margin-left: -18px;
|
129
|
+
}
|
130
|
+
|
131
|
+
.netless-window-manager-pencilEraser-3-offset {
|
132
|
+
margin-top: -14px;
|
133
|
+
margin-left: -6px;
|
134
|
+
}
|
135
|
+
|
122
136
|
.netless-window-manager-cursor-name {
|
123
137
|
width: 100%;
|
124
138
|
height: 48px;
|
package/src/typings.ts
CHANGED
@@ -87,7 +87,7 @@ export type RegisterParams<AppOptions = any, SetupResult = any, Attributes exten
|
|
87
87
|
|
88
88
|
export type AppListenerKeys = keyof AppEmitterEvent;
|
89
89
|
|
90
|
-
export type ApplianceIcons = Partial<Record
|
90
|
+
export type ApplianceIcons = Partial<Record<`${ApplianceNames}` | string, string>>;
|
91
91
|
|
92
92
|
export type Writeable<T> = { -readonly [P in keyof T]: T[P] };
|
93
93
|
|