@netless/window-manager 0.4.3 → 0.4.4
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.d.ts +6 -1
- package/dist/index.es.js +2 -2
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/docs/api.md +9 -0
- package/package.json +1 -1
- package/src/View/ViewManager.ts +10 -2
- package/src/index.ts +29 -43
package/docs/api.md
CHANGED
@@ -14,6 +14,15 @@
|
|
14
14
|
- [`cleanCurrentScene`](#cleanCurrentScene)
|
15
15
|
- [`redo`](#redo)
|
16
16
|
- [`undo`](#undo)
|
17
|
+
- [`copy`](#copy)
|
18
|
+
- [`paste`](#paste)
|
19
|
+
- [`delete`](#delete)
|
20
|
+
- [`duplicate`](#duplicate)
|
21
|
+
- [`insertText`](#insertText)
|
22
|
+
- [`insertImage`](#insertImage)
|
23
|
+
- [`completeImageUpload`](#completeImageUpload)
|
24
|
+
- [`lockImage`](#lockImage)
|
25
|
+
- [`lockImages`](#lockImages)
|
17
26
|
- [实例属性](#prototypes)
|
18
27
|
- [事件回调](#events)
|
19
28
|
|
package/package.json
CHANGED
package/src/View/ViewManager.ts
CHANGED
@@ -18,7 +18,11 @@ export class ViewManager {
|
|
18
18
|
public destroyView(id: string): void {
|
19
19
|
const view = this.views.get(id);
|
20
20
|
if (view) {
|
21
|
-
|
21
|
+
try {
|
22
|
+
view.release();
|
23
|
+
} catch {
|
24
|
+
// ignore
|
25
|
+
}
|
22
26
|
this.views.delete(id);
|
23
27
|
}
|
24
28
|
}
|
@@ -32,7 +36,11 @@ export class ViewManager {
|
|
32
36
|
|
33
37
|
public destroy() {
|
34
38
|
this.views.forEach(view => {
|
35
|
-
|
39
|
+
try {
|
40
|
+
view.release();
|
41
|
+
} catch {
|
42
|
+
// ignore
|
43
|
+
}
|
36
44
|
});
|
37
45
|
this.views.clear();
|
38
46
|
}
|
package/src/index.ts
CHANGED
@@ -47,6 +47,7 @@ import type {
|
|
47
47
|
ViewVisionMode,
|
48
48
|
CameraState,
|
49
49
|
Player,
|
50
|
+
ImageInformation,
|
50
51
|
} from "white-web-sdk";
|
51
52
|
import type { AppListeners } from "./AppListener";
|
52
53
|
import type { NetlessApp, RegisterParams } from "./typings";
|
@@ -615,7 +616,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
615
616
|
}
|
616
617
|
|
617
618
|
public get focusedView(): View | undefined {
|
618
|
-
return this.appManager?.focusApp?.view;
|
619
|
+
return this.appManager?.focusApp?.view || this.mainView;
|
619
620
|
}
|
620
621
|
|
621
622
|
public get mainViewSceneIndex(): number {
|
@@ -772,66 +773,51 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
772
773
|
}
|
773
774
|
|
774
775
|
public cleanCurrentScene(): void {
|
775
|
-
|
776
|
-
if (focused) {
|
777
|
-
this.focusedView?.cleanCurrentScene();
|
778
|
-
} else {
|
779
|
-
this.mainView.cleanCurrentScene();
|
780
|
-
}
|
776
|
+
this.focusedView?.cleanCurrentScene();
|
781
777
|
}
|
782
778
|
|
783
779
|
public redo(): number {
|
784
|
-
|
785
|
-
if (focused) {
|
786
|
-
return this.focusedView?.redo() || 0;
|
787
|
-
} else {
|
788
|
-
return this.mainView.redo();
|
789
|
-
}
|
780
|
+
return this.focusedView?.redo() || 0;
|
790
781
|
}
|
791
782
|
|
792
783
|
public undo(): number {
|
793
|
-
|
794
|
-
if (focused) {
|
795
|
-
return this.focusedView?.undo() || 0;
|
796
|
-
} else {
|
797
|
-
return this.mainView.undo();
|
798
|
-
}
|
784
|
+
return this.focusedView?.undo() || 0;
|
799
785
|
}
|
800
786
|
|
801
787
|
public delete(): void {
|
802
|
-
|
803
|
-
if (focused) {
|
804
|
-
this.focusedView?.delete();
|
805
|
-
} else {
|
806
|
-
this.mainView.delete();
|
807
|
-
}
|
788
|
+
this.focusedView?.delete();
|
808
789
|
}
|
809
790
|
|
810
791
|
public copy(): void {
|
811
|
-
|
812
|
-
if (focused) {
|
813
|
-
this.focusedView?.copy();
|
814
|
-
} else {
|
815
|
-
this.mainView.copy();
|
816
|
-
}
|
792
|
+
this.focusedView?.copy();
|
817
793
|
}
|
818
794
|
|
819
795
|
public paste(): void {
|
820
|
-
|
821
|
-
if (focused) {
|
822
|
-
this.focusedView?.paste();
|
823
|
-
} else {
|
824
|
-
this.mainView.paste();
|
825
|
-
}
|
796
|
+
this.focusedView?.paste();
|
826
797
|
}
|
827
798
|
|
828
799
|
public duplicate(): void {
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
800
|
+
this.focusedView?.duplicate();
|
801
|
+
}
|
802
|
+
|
803
|
+
public insertText(x: number, y: number, text: string): string {
|
804
|
+
return this.focusedView?.insertText(x, y, text) || "";
|
805
|
+
}
|
806
|
+
|
807
|
+
public insertImage(info: ImageInformation): void {
|
808
|
+
return this.focusedView?.insertImage(info);
|
809
|
+
}
|
810
|
+
|
811
|
+
public completeImageUpload(uuid: string, url: string): void {
|
812
|
+
return this.focusedView?.completeImageUpload(uuid, url);
|
813
|
+
}
|
814
|
+
|
815
|
+
public lockImage(uuid: string, locked: boolean): void {
|
816
|
+
return this.focusedView?.lockImage(uuid, locked);
|
817
|
+
}
|
818
|
+
|
819
|
+
public lockImages(locked: boolean): void {
|
820
|
+
return this.focusedView?.lockImages(locked);
|
835
821
|
}
|
836
822
|
|
837
823
|
private isDynamicPPT(scenes: SceneDefinition[]) {
|