@openfin/core 30.73.1 → 30.73.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
|
@@ -9,17 +9,17 @@ export declare class TabDragController {
|
|
|
9
9
|
constructor(viewOverlay: ViewOverlay);
|
|
10
10
|
private dropZonePreview?;
|
|
11
11
|
/**
|
|
12
|
-
* When a tab is dragged from a stack greater than one, it's view will need to be hidden and the
|
|
13
|
-
* view next in the stack shown.
|
|
14
12
|
*
|
|
15
|
-
*
|
|
13
|
+
* When a tab is dragged out of a stack, it will need to be hidden from the stack.
|
|
16
14
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @param
|
|
15
|
+
* Additionally, if there is a new view to show in the stack, it will be shown at the position specified by
|
|
16
|
+
* containerBounds
|
|
17
|
+
*
|
|
18
|
+
* @param draggingView The view which is currently being dragged
|
|
19
|
+
* @param containerBounds The bounds of the container of the view to be shown in the stack
|
|
20
|
+
* @param nextView The view which has become active after dragging the draggingView out.
|
|
21
21
|
*/
|
|
22
|
-
handleTabStackActiveView: (
|
|
22
|
+
handleTabStackActiveView: (draggingView: View, containerBounds?: OpenFin.Bounds, nextView?: View) => Promise<void>;
|
|
23
23
|
/**
|
|
24
24
|
* Extracts the border and backgroundColor css values from the drop zone preview,
|
|
25
25
|
* and sets the viewOverlay to match them.
|
|
@@ -38,6 +38,8 @@ export declare class TabDragController {
|
|
|
38
38
|
* Disables the click through setting on every view in the platform.
|
|
39
39
|
*/
|
|
40
40
|
endDrag: () => Promise<void>;
|
|
41
|
+
private disposeObserve?;
|
|
42
|
+
disposeOverlayObserver: () => void;
|
|
41
43
|
/**
|
|
42
44
|
* Observes a golden-layout drop zone preview in order to render a BrowserView
|
|
43
45
|
* overlay whenever a tab is dragged over a droppable region.
|
|
@@ -11,29 +11,28 @@ class TabDragController {
|
|
|
11
11
|
constructor(viewOverlay) {
|
|
12
12
|
this.viewOverlay = viewOverlay;
|
|
13
13
|
/**
|
|
14
|
-
* When a tab is dragged from a stack greater than one, it's view will need to be hidden and the
|
|
15
|
-
* view next in the stack shown.
|
|
16
14
|
*
|
|
17
|
-
*
|
|
15
|
+
* When a tab is dragged out of a stack, it will need to be hidden from the stack.
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @param
|
|
17
|
+
* Additionally, if there is a new view to show in the stack, it will be shown at the position specified by
|
|
18
|
+
* containerBounds
|
|
19
|
+
*
|
|
20
|
+
* @param draggingView The view which is currently being dragged
|
|
21
|
+
* @param containerBounds The bounds of the container of the view to be shown in the stack
|
|
22
|
+
* @param nextView The view which has become active after dragging the draggingView out.
|
|
23
23
|
*/
|
|
24
|
-
this.handleTabStackActiveView = async (
|
|
24
|
+
this.handleTabStackActiveView = async (draggingView, containerBounds, nextView) => {
|
|
25
25
|
if (this.dropZonePreview) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
await Promise.all([hideMovingViewIfPossible(), showCurrentView()]);
|
|
26
|
+
if (nextView && containerBounds) {
|
|
27
|
+
// Due to https://github.com/electron/electron/issues/20064,
|
|
28
|
+
// setBounds does not work in certain scenarios.
|
|
29
|
+
// Therefore we call it twice before and after showing to ensure as much
|
|
30
|
+
// visual fidelity as possible (although flicker can still occur).
|
|
31
|
+
await (nextView === null || nextView === void 0 ? void 0 : nextView.setBounds(containerBounds));
|
|
32
|
+
await (nextView === null || nextView === void 0 ? void 0 : nextView.show());
|
|
33
|
+
await (nextView === null || nextView === void 0 ? void 0 : nextView.setBounds(containerBounds));
|
|
34
|
+
}
|
|
35
|
+
await draggingView.hide();
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
38
|
/**
|
|
@@ -63,6 +62,12 @@ class TabDragController {
|
|
|
63
62
|
this.endDrag = async () => {
|
|
64
63
|
await this.viewOverlay.setIgnoreViewMouseEvents(false);
|
|
65
64
|
};
|
|
65
|
+
this.disposeOverlayObserver = () => {
|
|
66
|
+
if (this.disposeObserve) {
|
|
67
|
+
this.disposeObserve();
|
|
68
|
+
}
|
|
69
|
+
this.dropZonePreview = undefined;
|
|
70
|
+
};
|
|
66
71
|
/**
|
|
67
72
|
* Observes a golden-layout drop zone preview in order to render a BrowserView
|
|
68
73
|
* overlay whenever a tab is dragged over a droppable region.
|
|
@@ -74,7 +79,7 @@ class TabDragController {
|
|
|
74
79
|
this.dropZonePreview = dropZonePreview;
|
|
75
80
|
let lastBounds;
|
|
76
81
|
dropZonePreview.style.visibility = 'hidden';
|
|
77
|
-
|
|
82
|
+
const onDropAreaHighlighted = async (e) => {
|
|
78
83
|
try {
|
|
79
84
|
const { bounds } = e.detail;
|
|
80
85
|
if (!lastBounds || !bounds_observer_1.isDomRectEqual(lastBounds, bounds)) {
|
|
@@ -85,8 +90,8 @@ class TabDragController {
|
|
|
85
90
|
catch (error) {
|
|
86
91
|
console.warn('Unexpected error encountered rendering tab drag preview.', error);
|
|
87
92
|
}
|
|
88
|
-
}
|
|
89
|
-
|
|
93
|
+
};
|
|
94
|
+
const onDropAreaHidden = async () => {
|
|
90
95
|
try {
|
|
91
96
|
lastBounds = undefined;
|
|
92
97
|
await this.viewOverlay.detachOverlay();
|
|
@@ -94,7 +99,16 @@ class TabDragController {
|
|
|
94
99
|
catch (error) {
|
|
95
100
|
console.warn('Unexpected error encountered hiding tab drag preview.', error);
|
|
96
101
|
}
|
|
97
|
-
}
|
|
102
|
+
};
|
|
103
|
+
dropZonePreview.addEventListener('drop-area-highlighted', onDropAreaHighlighted);
|
|
104
|
+
dropZonePreview.addEventListener('drop-area-hidden', onDropAreaHidden);
|
|
105
|
+
this.disposeObserve = () => {
|
|
106
|
+
dropZonePreview.removeEventListener('drop-area-highlighted', onDropAreaHighlighted);
|
|
107
|
+
dropZonePreview.removeEventListener('drop-area-hidden', onDropAreaHidden);
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
console.warn('Tried to observe a drop zone overlay without disposing the previous.');
|
|
98
112
|
}
|
|
99
113
|
};
|
|
100
114
|
}
|