dock-spawn-ts 2.513.1 → 2.515.0
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/lib/es5/dock-spawn-ts.js +1 -1
- package/lib/js/ContainerType.d.ts +6 -6
- package/lib/js/ContainerType.js +7 -7
- package/lib/js/Dialog.d.ts +43 -43
- package/lib/js/Dialog.js +136 -136
- package/lib/js/DockConfig.d.ts +7 -7
- package/lib/js/DockConfig.js +8 -8
- package/lib/js/DockGraphDeserializer.d.ts +18 -18
- package/lib/js/DockGraphDeserializer.js +116 -116
- package/lib/js/DockGraphSerializer.d.ts +13 -13
- package/lib/js/DockGraphSerializer.js +40 -40
- package/lib/js/DockLayoutEngine.d.ts +35 -35
- package/lib/js/DockLayoutEngine.js +319 -319
- package/lib/js/DockManager.d.ts +153 -153
- package/lib/js/DockManager.js +730 -728
- package/lib/js/DockManager.js.map +1 -1
- package/lib/js/DockManagerContext.d.ts +9 -9
- package/lib/js/DockManagerContext.js +9 -9
- package/lib/js/DockModel.d.ts +8 -8
- package/lib/js/DockModel.js +5 -5
- package/lib/js/DockNode.d.ts +15 -15
- package/lib/js/DockNode.js +61 -61
- package/lib/js/DockWheel.d.ts +40 -40
- package/lib/js/DockWheel.js +200 -200
- package/lib/js/DockWheelItem.d.ts +15 -15
- package/lib/js/DockWheelItem.js +27 -27
- package/lib/js/DocumentManagerContainer.d.ts +16 -16
- package/lib/js/DocumentManagerContainer.js +28 -28
- package/lib/js/DocumentTabPage.d.ts +14 -14
- package/lib/js/DocumentTabPage.js +26 -26
- package/lib/js/DraggableContainer.d.ts +52 -52
- package/lib/js/DraggableContainer.js +183 -183
- package/lib/js/EventHandler.d.ts +7 -7
- package/lib/js/EventHandler.js +11 -11
- package/lib/js/Exports.d.ts +30 -30
- package/lib/js/Exports.js +30 -30
- package/lib/js/FillDockContainer.d.ts +33 -33
- package/lib/js/FillDockContainer.js +69 -69
- package/lib/js/HorizontalDockContainer.d.ts +6 -6
- package/lib/js/HorizontalDockContainer.js +9 -9
- package/lib/js/PanelContainer.d.ts +101 -101
- package/lib/js/PanelContainer.js +384 -384
- package/lib/js/PanelContainer.js.map +1 -1
- package/lib/js/Point.d.ts +5 -5
- package/lib/js/Point.js +6 -6
- package/lib/js/ResizableContainer.d.ts +55 -55
- package/lib/js/ResizableContainer.js +241 -241
- package/lib/js/ResizeHandle.d.ts +15 -15
- package/lib/js/ResizeHandle.js +48 -48
- package/lib/js/SplitterBar.d.ts +35 -35
- package/lib/js/SplitterBar.js +149 -149
- package/lib/js/SplitterDockContainer.d.ts +35 -35
- package/lib/js/SplitterDockContainer.js +65 -65
- package/lib/js/SplitterPanel.d.ts +26 -26
- package/lib/js/SplitterPanel.js +191 -191
- package/lib/js/TabHandle.d.ts +55 -55
- package/lib/js/TabHandle.js +261 -260
- package/lib/js/TabHandle.js.map +1 -1
- package/lib/js/TabHost.d.ts +46 -46
- package/lib/js/TabHost.js +223 -223
- package/lib/js/TabHost.js.map +1 -1
- package/lib/js/TabPage.d.ts +19 -19
- package/lib/js/TabPage.js +74 -73
- package/lib/js/TabPage.js.map +1 -1
- package/lib/js/UndockInitiator.d.ts +31 -31
- package/lib/js/UndockInitiator.js +140 -140
- package/lib/js/Utils.d.ts +14 -14
- package/lib/js/Utils.js +70 -69
- package/lib/js/Utils.js.map +1 -1
- package/lib/js/VerticalDockContainer.d.ts +6 -6
- package/lib/js/VerticalDockContainer.js +9 -9
- package/lib/js/enums/PanelType.d.ts +4 -4
- package/lib/js/enums/PanelType.js +5 -5
- package/lib/js/enums/TabHostDirection.d.ts +6 -6
- package/lib/js/enums/TabHostDirection.js +7 -7
- package/lib/js/enums/WheelTypes.d.ts +11 -11
- package/lib/js/enums/WheelTypes.js +14 -14
- package/lib/js/interfaces/IDockContainer.d.ts +25 -25
- package/lib/js/interfaces/IDockContainer.js +1 -1
- package/lib/js/interfaces/IDockContainerWithSize.d.ts +5 -5
- package/lib/js/interfaces/IDockContainerWithSize.js +1 -1
- package/lib/js/interfaces/ILayoutEventListener.d.ts +26 -26
- package/lib/js/interfaces/ILayoutEventListener.js +1 -1
- package/lib/js/interfaces/IMouseOrTouchEvent.d.ts +6 -6
- package/lib/js/interfaces/IMouseOrTouchEvent.js +1 -1
- package/lib/js/interfaces/INodeInfo.d.ts +7 -7
- package/lib/js/interfaces/INodeInfo.js +1 -1
- package/lib/js/interfaces/IPanelInfo.d.ts +9 -9
- package/lib/js/interfaces/IPanelInfo.js +1 -1
- package/lib/js/interfaces/IRectangle.d.ts +6 -6
- package/lib/js/interfaces/IRectangle.js +1 -1
- package/lib/js/interfaces/ISize.d.ts +4 -4
- package/lib/js/interfaces/ISize.js +1 -1
- package/lib/js/interfaces/IState.d.ts +10 -10
- package/lib/js/interfaces/IState.js +1 -1
- package/lib/js/interfaces/IThickness.d.ts +6 -6
- package/lib/js/interfaces/IThickness.js +1 -1
- package/lib/js/webcomponent/DockSpawnTsWebcomponent.d.ts +31 -30
- package/lib/js/webcomponent/DockSpawnTsWebcomponent.js +158 -152
- package/lib/js/webcomponent/DockSpawnTsWebcomponent.js.map +1 -1
- package/package.json +6 -6
- package/src/DockManager.ts +5 -3
- package/src/PanelContainer.ts +1 -1
- package/src/TabHost.ts +5 -5
- package/src/TabPage.ts +4 -3
- package/src/webcomponent/DockSpawnTsWebcomponent.ts +6 -0
package/lib/js/DockWheel.js
CHANGED
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
import { Utils } from "./Utils.js";
|
|
2
|
-
import { DockWheelItem } from "./DockWheelItem.js";
|
|
3
|
-
import { WheelTypes } from "./enums/WheelTypes.js";
|
|
4
|
-
/**
|
|
5
|
-
* Manages the dock overlay buttons that are displayed over the dock manager
|
|
6
|
-
*/
|
|
7
|
-
export class DockWheel {
|
|
8
|
-
constructor(dockManager) {
|
|
9
|
-
this.dockManager = dockManager;
|
|
10
|
-
this.elementMainWheel = document.createElement('div'); // Contains the main wheel's 5 dock buttons
|
|
11
|
-
this.elementSideWheel = document.createElement('div'); // Contains the 4 buttons on the side
|
|
12
|
-
this.wheelItems = {};
|
|
13
|
-
for (let wheelType in WheelTypes) {
|
|
14
|
-
this.wheelItems[wheelType] = new DockWheelItem(this, wheelType);
|
|
15
|
-
if (wheelType.substr(-2, 2) === '-s')
|
|
16
|
-
// Side button
|
|
17
|
-
this.elementSideWheel.appendChild(this.wheelItems[wheelType].element);
|
|
18
|
-
else
|
|
19
|
-
// Main dock wheel button
|
|
20
|
-
this.elementMainWheel.appendChild(this.wheelItems[wheelType].element);
|
|
21
|
-
}
|
|
22
|
-
;
|
|
23
|
-
let zIndex = 9000000;
|
|
24
|
-
this.elementMainWheel.classList.add('dock-wheel-base');
|
|
25
|
-
this.elementSideWheel.classList.add('dock-wheel-base');
|
|
26
|
-
this.elementMainWheel.style.zIndex = String(zIndex + 1);
|
|
27
|
-
this.elementSideWheel.style.zIndex = String(zIndex);
|
|
28
|
-
this.elementPanelPreview = document.createElement('div');
|
|
29
|
-
this.elementPanelPreview.classList.add('dock-wheel-panel-preview');
|
|
30
|
-
this.elementPanelPreview.style.zIndex = String(zIndex - 1);
|
|
31
|
-
this.activeDialog = undefined; // The dialog being dragged, when the wheel is visible
|
|
32
|
-
this._activeNode = undefined;
|
|
33
|
-
this._visible = false;
|
|
34
|
-
}
|
|
35
|
-
/** The node over which the dock wheel is being displayed on */
|
|
36
|
-
get activeNode() {
|
|
37
|
-
return this._activeNode;
|
|
38
|
-
}
|
|
39
|
-
set activeNode(value) {
|
|
40
|
-
let previousValue = this._activeNode;
|
|
41
|
-
this._activeNode = value;
|
|
42
|
-
if (previousValue !== this._activeNode) {
|
|
43
|
-
// The active node has been changed.
|
|
44
|
-
// Reattach the wheel to the new node's element and show it again
|
|
45
|
-
if (this._visible)
|
|
46
|
-
this.showWheel();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
showWheel() {
|
|
50
|
-
this._visible = true;
|
|
51
|
-
if (!this.activeNode) {
|
|
52
|
-
// No active node selected. make sure the wheel is invisible
|
|
53
|
-
Utils.removeNode(this.elementMainWheel);
|
|
54
|
-
Utils.removeNode(this.elementSideWheel);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
let element = this.activeNode.container.containerElement;
|
|
58
|
-
let containerWidth = element.clientWidth;
|
|
59
|
-
let containerHeight = element.clientHeight;
|
|
60
|
-
let baseX = Math.floor(containerWidth / 2); // + element.offsetLeft;
|
|
61
|
-
let baseY = Math.floor(containerHeight / 2); // + element.offsetTop;
|
|
62
|
-
let bcElement = element.getBoundingClientRect();
|
|
63
|
-
let bcdockManagerElement = this.dockManager.element.getBoundingClientRect();
|
|
64
|
-
this.elementMainWheel.style.left = (bcElement.left - bcdockManagerElement.left + baseX) + 'px';
|
|
65
|
-
this.elementMainWheel.style.top = (bcElement.top - bcdockManagerElement.top + baseY) + 'px';
|
|
66
|
-
// The positioning of the main dock wheel buttons is done automatically through CSS
|
|
67
|
-
// Dynamically calculate the positions of the buttons on the extreme sides of the dock manager
|
|
68
|
-
let sideMargin = 20;
|
|
69
|
-
let dockManagerWidth = this.dockManager.element.clientWidth;
|
|
70
|
-
let dockManagerHeight = this.dockManager.element.clientHeight;
|
|
71
|
-
Utils.removeNode(this.elementMainWheel);
|
|
72
|
-
Utils.removeNode(this.elementSideWheel);
|
|
73
|
-
this.dockManager.element.appendChild(this.elementMainWheel);
|
|
74
|
-
this.dockManager.element.appendChild(this.elementSideWheel);
|
|
75
|
-
this._setWheelButtonPosition(WheelTypes["left-s"], sideMargin, -dockManagerHeight / 2);
|
|
76
|
-
this._setWheelButtonPosition(WheelTypes["right-s"], dockManagerWidth - sideMargin * 2, -dockManagerHeight / 2);
|
|
77
|
-
this._setWheelButtonPosition(WheelTypes["top-s"], dockManagerWidth / 2, -dockManagerHeight + sideMargin);
|
|
78
|
-
this._setWheelButtonPosition(WheelTypes["down-s"], dockManagerWidth / 2, -sideMargin);
|
|
79
|
-
}
|
|
80
|
-
_setWheelButtonPosition(wheelId, left, top) {
|
|
81
|
-
let item = this.wheelItems[wheelId];
|
|
82
|
-
let itemHalfWidth = item.element.clientWidth / 2;
|
|
83
|
-
let itemHalfHeight = item.element.clientHeight / 2;
|
|
84
|
-
let x = Math.floor(left - itemHalfWidth);
|
|
85
|
-
let y = Math.floor(top - itemHalfHeight);
|
|
86
|
-
// item.element.style.left = '${x}px';
|
|
87
|
-
// item.element.style.top = '${y}px';
|
|
88
|
-
item.element.style.marginLeft = x + 'px';
|
|
89
|
-
item.element.style.marginTop = y + 'px';
|
|
90
|
-
}
|
|
91
|
-
hideWheel() {
|
|
92
|
-
this._visible = false;
|
|
93
|
-
this.activeNode = undefined;
|
|
94
|
-
Utils.removeNode(this.elementMainWheel);
|
|
95
|
-
Utils.removeNode(this.elementSideWheel);
|
|
96
|
-
Utils.removeNode(this.elementPanelPreview);
|
|
97
|
-
// deactivate all wheels
|
|
98
|
-
for (let wheelType in this.wheelItems)
|
|
99
|
-
this.wheelItems[wheelType].active = false;
|
|
100
|
-
}
|
|
101
|
-
onMouseOver(wheelItem) {
|
|
102
|
-
if (!this.activeDialog)
|
|
103
|
-
return;
|
|
104
|
-
// Display the preview panel to show where the panel would be docked
|
|
105
|
-
let rootNode = this.dockManager.context.model.rootNode;
|
|
106
|
-
let bounds;
|
|
107
|
-
if (wheelItem.id === WheelTypes.top) {
|
|
108
|
-
bounds = this.dockManager.layoutEngine.getDockBounds(this.activeNode, this.activeDialog.panel, 'vertical', true);
|
|
109
|
-
}
|
|
110
|
-
else if (wheelItem.id === WheelTypes.down) {
|
|
111
|
-
bounds = this.dockManager.layoutEngine.getDockBounds(this.activeNode, this.activeDialog.panel, 'vertical', false);
|
|
112
|
-
}
|
|
113
|
-
else if (wheelItem.id === WheelTypes.left) {
|
|
114
|
-
bounds = this.dockManager.layoutEngine.getDockBounds(this.activeNode, this.activeDialog.panel, 'horizontal', true);
|
|
115
|
-
}
|
|
116
|
-
else if (wheelItem.id === WheelTypes.right) {
|
|
117
|
-
bounds = this.dockManager.layoutEngine.getDockBounds(this.activeNode, this.activeDialog.panel, 'horizontal', false);
|
|
118
|
-
}
|
|
119
|
-
else if (wheelItem.id === WheelTypes.fill) {
|
|
120
|
-
bounds = this.dockManager.layoutEngine.getDockBounds(this.activeNode, this.activeDialog.panel, 'fill', false);
|
|
121
|
-
}
|
|
122
|
-
else if (wheelItem.id === WheelTypes["top-s"]) {
|
|
123
|
-
bounds = this.dockManager.layoutEngine.getDockBounds(rootNode, this.activeDialog.panel, 'vertical', true);
|
|
124
|
-
}
|
|
125
|
-
else if (wheelItem.id === WheelTypes["down-s"]) {
|
|
126
|
-
bounds = this.dockManager.layoutEngine.getDockBounds(rootNode, this.activeDialog.panel, 'vertical', false);
|
|
127
|
-
}
|
|
128
|
-
else if (wheelItem.id === WheelTypes["left-s"]) {
|
|
129
|
-
bounds = this.dockManager.layoutEngine.getDockBounds(rootNode, this.activeDialog.panel, 'horizontal', true);
|
|
130
|
-
}
|
|
131
|
-
else if (wheelItem.id === WheelTypes["right-s"]) {
|
|
132
|
-
bounds = this.dockManager.layoutEngine.getDockBounds(rootNode, this.activeDialog.panel, 'horizontal', false);
|
|
133
|
-
}
|
|
134
|
-
if (bounds) {
|
|
135
|
-
this.dockManager.element.appendChild(this.elementPanelPreview);
|
|
136
|
-
this.elementPanelPreview.style.left = Math.round(bounds.x) + 'px';
|
|
137
|
-
this.elementPanelPreview.style.top = Math.round(bounds.y) + 'px';
|
|
138
|
-
this.elementPanelPreview.style.width = Math.round(bounds.width) + 'px';
|
|
139
|
-
this.elementPanelPreview.style.height = Math.round(bounds.height) + 'px';
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
onMouseOut() {
|
|
143
|
-
Utils.removeNode(this.elementPanelPreview);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Called if the dialog is dropped in a dock panel.
|
|
147
|
-
* The dialog might not necessarily be dropped in one of the dock wheel buttons,
|
|
148
|
-
* in which case the request will be ignored
|
|
149
|
-
*/
|
|
150
|
-
onDialogDropped(dialog) {
|
|
151
|
-
// Check if the dialog was dropped in one of the wheel items
|
|
152
|
-
let wheelItem = this._getActiveWheelItem();
|
|
153
|
-
if (wheelItem)
|
|
154
|
-
this._handleDockRequest(wheelItem, dialog);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Returns the wheel item which has the mouse cursor on top of it
|
|
158
|
-
*/
|
|
159
|
-
_getActiveWheelItem() {
|
|
160
|
-
for (let wheelType in this.wheelItems) {
|
|
161
|
-
let wheelItem = this.wheelItems[wheelType];
|
|
162
|
-
if (wheelItem.active)
|
|
163
|
-
return wheelItem;
|
|
164
|
-
}
|
|
165
|
-
return undefined;
|
|
166
|
-
}
|
|
167
|
-
_handleDockRequest(wheelItem, dialog) {
|
|
168
|
-
wheelItem.active = false;
|
|
169
|
-
wheelItem.element.classList.remove(wheelItem.hoverIconClass);
|
|
170
|
-
if (!this.activeNode)
|
|
171
|
-
return;
|
|
172
|
-
if (wheelItem.id === WheelTypes.left) {
|
|
173
|
-
this.dockManager.dockDialogLeft(this.activeNode, dialog);
|
|
174
|
-
}
|
|
175
|
-
else if (wheelItem.id === WheelTypes.right) {
|
|
176
|
-
this.dockManager.dockDialogRight(this.activeNode, dialog);
|
|
177
|
-
}
|
|
178
|
-
else if (wheelItem.id === WheelTypes.top) {
|
|
179
|
-
this.dockManager.dockDialogUp(this.activeNode, dialog);
|
|
180
|
-
}
|
|
181
|
-
else if (wheelItem.id === WheelTypes.down) {
|
|
182
|
-
this.dockManager.dockDialogDown(this.activeNode, dialog);
|
|
183
|
-
}
|
|
184
|
-
else if (wheelItem.id === WheelTypes.fill) {
|
|
185
|
-
this.dockManager.dockDialogFill(this.activeNode, dialog);
|
|
186
|
-
}
|
|
187
|
-
else if (wheelItem.id === WheelTypes["left-s"]) {
|
|
188
|
-
this.dockManager.dockDialogLeft(this.dockManager.context.model.rootNode, dialog);
|
|
189
|
-
}
|
|
190
|
-
else if (wheelItem.id === WheelTypes["right-s"]) {
|
|
191
|
-
this.dockManager.dockDialogRight(this.dockManager.context.model.rootNode, dialog);
|
|
192
|
-
}
|
|
193
|
-
else if (wheelItem.id === WheelTypes["top-s"]) {
|
|
194
|
-
this.dockManager.dockDialogUp(this.dockManager.context.model.rootNode, dialog);
|
|
195
|
-
}
|
|
196
|
-
else if (wheelItem.id === WheelTypes["down-s"]) {
|
|
197
|
-
this.dockManager.dockDialogDown(this.dockManager.context.model.rootNode, dialog);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
1
|
+
import { Utils } from "./Utils.js";
|
|
2
|
+
import { DockWheelItem } from "./DockWheelItem.js";
|
|
3
|
+
import { WheelTypes } from "./enums/WheelTypes.js";
|
|
4
|
+
/**
|
|
5
|
+
* Manages the dock overlay buttons that are displayed over the dock manager
|
|
6
|
+
*/
|
|
7
|
+
export class DockWheel {
|
|
8
|
+
constructor(dockManager) {
|
|
9
|
+
this.dockManager = dockManager;
|
|
10
|
+
this.elementMainWheel = document.createElement('div'); // Contains the main wheel's 5 dock buttons
|
|
11
|
+
this.elementSideWheel = document.createElement('div'); // Contains the 4 buttons on the side
|
|
12
|
+
this.wheelItems = {};
|
|
13
|
+
for (let wheelType in WheelTypes) {
|
|
14
|
+
this.wheelItems[wheelType] = new DockWheelItem(this, wheelType);
|
|
15
|
+
if (wheelType.substr(-2, 2) === '-s')
|
|
16
|
+
// Side button
|
|
17
|
+
this.elementSideWheel.appendChild(this.wheelItems[wheelType].element);
|
|
18
|
+
else
|
|
19
|
+
// Main dock wheel button
|
|
20
|
+
this.elementMainWheel.appendChild(this.wheelItems[wheelType].element);
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
let zIndex = 9000000;
|
|
24
|
+
this.elementMainWheel.classList.add('dock-wheel-base');
|
|
25
|
+
this.elementSideWheel.classList.add('dock-wheel-base');
|
|
26
|
+
this.elementMainWheel.style.zIndex = String(zIndex + 1);
|
|
27
|
+
this.elementSideWheel.style.zIndex = String(zIndex);
|
|
28
|
+
this.elementPanelPreview = document.createElement('div');
|
|
29
|
+
this.elementPanelPreview.classList.add('dock-wheel-panel-preview');
|
|
30
|
+
this.elementPanelPreview.style.zIndex = String(zIndex - 1);
|
|
31
|
+
this.activeDialog = undefined; // The dialog being dragged, when the wheel is visible
|
|
32
|
+
this._activeNode = undefined;
|
|
33
|
+
this._visible = false;
|
|
34
|
+
}
|
|
35
|
+
/** The node over which the dock wheel is being displayed on */
|
|
36
|
+
get activeNode() {
|
|
37
|
+
return this._activeNode;
|
|
38
|
+
}
|
|
39
|
+
set activeNode(value) {
|
|
40
|
+
let previousValue = this._activeNode;
|
|
41
|
+
this._activeNode = value;
|
|
42
|
+
if (previousValue !== this._activeNode) {
|
|
43
|
+
// The active node has been changed.
|
|
44
|
+
// Reattach the wheel to the new node's element and show it again
|
|
45
|
+
if (this._visible)
|
|
46
|
+
this.showWheel();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
showWheel() {
|
|
50
|
+
this._visible = true;
|
|
51
|
+
if (!this.activeNode) {
|
|
52
|
+
// No active node selected. make sure the wheel is invisible
|
|
53
|
+
Utils.removeNode(this.elementMainWheel);
|
|
54
|
+
Utils.removeNode(this.elementSideWheel);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
let element = this.activeNode.container.containerElement;
|
|
58
|
+
let containerWidth = element.clientWidth;
|
|
59
|
+
let containerHeight = element.clientHeight;
|
|
60
|
+
let baseX = Math.floor(containerWidth / 2); // + element.offsetLeft;
|
|
61
|
+
let baseY = Math.floor(containerHeight / 2); // + element.offsetTop;
|
|
62
|
+
let bcElement = element.getBoundingClientRect();
|
|
63
|
+
let bcdockManagerElement = this.dockManager.element.getBoundingClientRect();
|
|
64
|
+
this.elementMainWheel.style.left = (bcElement.left - bcdockManagerElement.left + baseX) + 'px';
|
|
65
|
+
this.elementMainWheel.style.top = (bcElement.top - bcdockManagerElement.top + baseY) + 'px';
|
|
66
|
+
// The positioning of the main dock wheel buttons is done automatically through CSS
|
|
67
|
+
// Dynamically calculate the positions of the buttons on the extreme sides of the dock manager
|
|
68
|
+
let sideMargin = 20;
|
|
69
|
+
let dockManagerWidth = this.dockManager.element.clientWidth;
|
|
70
|
+
let dockManagerHeight = this.dockManager.element.clientHeight;
|
|
71
|
+
Utils.removeNode(this.elementMainWheel);
|
|
72
|
+
Utils.removeNode(this.elementSideWheel);
|
|
73
|
+
this.dockManager.element.appendChild(this.elementMainWheel);
|
|
74
|
+
this.dockManager.element.appendChild(this.elementSideWheel);
|
|
75
|
+
this._setWheelButtonPosition(WheelTypes["left-s"], sideMargin, -dockManagerHeight / 2);
|
|
76
|
+
this._setWheelButtonPosition(WheelTypes["right-s"], dockManagerWidth - sideMargin * 2, -dockManagerHeight / 2);
|
|
77
|
+
this._setWheelButtonPosition(WheelTypes["top-s"], dockManagerWidth / 2, -dockManagerHeight + sideMargin);
|
|
78
|
+
this._setWheelButtonPosition(WheelTypes["down-s"], dockManagerWidth / 2, -sideMargin);
|
|
79
|
+
}
|
|
80
|
+
_setWheelButtonPosition(wheelId, left, top) {
|
|
81
|
+
let item = this.wheelItems[wheelId];
|
|
82
|
+
let itemHalfWidth = item.element.clientWidth / 2;
|
|
83
|
+
let itemHalfHeight = item.element.clientHeight / 2;
|
|
84
|
+
let x = Math.floor(left - itemHalfWidth);
|
|
85
|
+
let y = Math.floor(top - itemHalfHeight);
|
|
86
|
+
// item.element.style.left = '${x}px';
|
|
87
|
+
// item.element.style.top = '${y}px';
|
|
88
|
+
item.element.style.marginLeft = x + 'px';
|
|
89
|
+
item.element.style.marginTop = y + 'px';
|
|
90
|
+
}
|
|
91
|
+
hideWheel() {
|
|
92
|
+
this._visible = false;
|
|
93
|
+
this.activeNode = undefined;
|
|
94
|
+
Utils.removeNode(this.elementMainWheel);
|
|
95
|
+
Utils.removeNode(this.elementSideWheel);
|
|
96
|
+
Utils.removeNode(this.elementPanelPreview);
|
|
97
|
+
// deactivate all wheels
|
|
98
|
+
for (let wheelType in this.wheelItems)
|
|
99
|
+
this.wheelItems[wheelType].active = false;
|
|
100
|
+
}
|
|
101
|
+
onMouseOver(wheelItem) {
|
|
102
|
+
if (!this.activeDialog)
|
|
103
|
+
return;
|
|
104
|
+
// Display the preview panel to show where the panel would be docked
|
|
105
|
+
let rootNode = this.dockManager.context.model.rootNode;
|
|
106
|
+
let bounds;
|
|
107
|
+
if (wheelItem.id === WheelTypes.top) {
|
|
108
|
+
bounds = this.dockManager.layoutEngine.getDockBounds(this.activeNode, this.activeDialog.panel, 'vertical', true);
|
|
109
|
+
}
|
|
110
|
+
else if (wheelItem.id === WheelTypes.down) {
|
|
111
|
+
bounds = this.dockManager.layoutEngine.getDockBounds(this.activeNode, this.activeDialog.panel, 'vertical', false);
|
|
112
|
+
}
|
|
113
|
+
else if (wheelItem.id === WheelTypes.left) {
|
|
114
|
+
bounds = this.dockManager.layoutEngine.getDockBounds(this.activeNode, this.activeDialog.panel, 'horizontal', true);
|
|
115
|
+
}
|
|
116
|
+
else if (wheelItem.id === WheelTypes.right) {
|
|
117
|
+
bounds = this.dockManager.layoutEngine.getDockBounds(this.activeNode, this.activeDialog.panel, 'horizontal', false);
|
|
118
|
+
}
|
|
119
|
+
else if (wheelItem.id === WheelTypes.fill) {
|
|
120
|
+
bounds = this.dockManager.layoutEngine.getDockBounds(this.activeNode, this.activeDialog.panel, 'fill', false);
|
|
121
|
+
}
|
|
122
|
+
else if (wheelItem.id === WheelTypes["top-s"]) {
|
|
123
|
+
bounds = this.dockManager.layoutEngine.getDockBounds(rootNode, this.activeDialog.panel, 'vertical', true);
|
|
124
|
+
}
|
|
125
|
+
else if (wheelItem.id === WheelTypes["down-s"]) {
|
|
126
|
+
bounds = this.dockManager.layoutEngine.getDockBounds(rootNode, this.activeDialog.panel, 'vertical', false);
|
|
127
|
+
}
|
|
128
|
+
else if (wheelItem.id === WheelTypes["left-s"]) {
|
|
129
|
+
bounds = this.dockManager.layoutEngine.getDockBounds(rootNode, this.activeDialog.panel, 'horizontal', true);
|
|
130
|
+
}
|
|
131
|
+
else if (wheelItem.id === WheelTypes["right-s"]) {
|
|
132
|
+
bounds = this.dockManager.layoutEngine.getDockBounds(rootNode, this.activeDialog.panel, 'horizontal', false);
|
|
133
|
+
}
|
|
134
|
+
if (bounds) {
|
|
135
|
+
this.dockManager.element.appendChild(this.elementPanelPreview);
|
|
136
|
+
this.elementPanelPreview.style.left = Math.round(bounds.x) + 'px';
|
|
137
|
+
this.elementPanelPreview.style.top = Math.round(bounds.y) + 'px';
|
|
138
|
+
this.elementPanelPreview.style.width = Math.round(bounds.width) + 'px';
|
|
139
|
+
this.elementPanelPreview.style.height = Math.round(bounds.height) + 'px';
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
onMouseOut() {
|
|
143
|
+
Utils.removeNode(this.elementPanelPreview);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Called if the dialog is dropped in a dock panel.
|
|
147
|
+
* The dialog might not necessarily be dropped in one of the dock wheel buttons,
|
|
148
|
+
* in which case the request will be ignored
|
|
149
|
+
*/
|
|
150
|
+
onDialogDropped(dialog) {
|
|
151
|
+
// Check if the dialog was dropped in one of the wheel items
|
|
152
|
+
let wheelItem = this._getActiveWheelItem();
|
|
153
|
+
if (wheelItem)
|
|
154
|
+
this._handleDockRequest(wheelItem, dialog);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Returns the wheel item which has the mouse cursor on top of it
|
|
158
|
+
*/
|
|
159
|
+
_getActiveWheelItem() {
|
|
160
|
+
for (let wheelType in this.wheelItems) {
|
|
161
|
+
let wheelItem = this.wheelItems[wheelType];
|
|
162
|
+
if (wheelItem.active)
|
|
163
|
+
return wheelItem;
|
|
164
|
+
}
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
_handleDockRequest(wheelItem, dialog) {
|
|
168
|
+
wheelItem.active = false;
|
|
169
|
+
wheelItem.element.classList.remove(wheelItem.hoverIconClass);
|
|
170
|
+
if (!this.activeNode)
|
|
171
|
+
return;
|
|
172
|
+
if (wheelItem.id === WheelTypes.left) {
|
|
173
|
+
this.dockManager.dockDialogLeft(this.activeNode, dialog);
|
|
174
|
+
}
|
|
175
|
+
else if (wheelItem.id === WheelTypes.right) {
|
|
176
|
+
this.dockManager.dockDialogRight(this.activeNode, dialog);
|
|
177
|
+
}
|
|
178
|
+
else if (wheelItem.id === WheelTypes.top) {
|
|
179
|
+
this.dockManager.dockDialogUp(this.activeNode, dialog);
|
|
180
|
+
}
|
|
181
|
+
else if (wheelItem.id === WheelTypes.down) {
|
|
182
|
+
this.dockManager.dockDialogDown(this.activeNode, dialog);
|
|
183
|
+
}
|
|
184
|
+
else if (wheelItem.id === WheelTypes.fill) {
|
|
185
|
+
this.dockManager.dockDialogFill(this.activeNode, dialog);
|
|
186
|
+
}
|
|
187
|
+
else if (wheelItem.id === WheelTypes["left-s"]) {
|
|
188
|
+
this.dockManager.dockDialogLeft(this.dockManager.context.model.rootNode, dialog);
|
|
189
|
+
}
|
|
190
|
+
else if (wheelItem.id === WheelTypes["right-s"]) {
|
|
191
|
+
this.dockManager.dockDialogRight(this.dockManager.context.model.rootNode, dialog);
|
|
192
|
+
}
|
|
193
|
+
else if (wheelItem.id === WheelTypes["top-s"]) {
|
|
194
|
+
this.dockManager.dockDialogUp(this.dockManager.context.model.rootNode, dialog);
|
|
195
|
+
}
|
|
196
|
+
else if (wheelItem.id === WheelTypes["down-s"]) {
|
|
197
|
+
this.dockManager.dockDialogDown(this.dockManager.context.model.rootNode, dialog);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
201
|
//# sourceMappingURL=DockWheel.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { EventHandler } from "./EventHandler.js";
|
|
2
|
-
import { DockWheel } from "./DockWheel.js";
|
|
3
|
-
import { WheelTypes } from "./enums/WheelTypes.js";
|
|
4
|
-
export declare class DockWheelItem {
|
|
5
|
-
wheel: DockWheel;
|
|
6
|
-
id: WheelTypes;
|
|
7
|
-
element: HTMLDivElement;
|
|
8
|
-
hoverIconClass: string;
|
|
9
|
-
mouseOverHandler: EventHandler;
|
|
10
|
-
mouseOutHandler: EventHandler;
|
|
11
|
-
active: boolean;
|
|
12
|
-
constructor(wheel: DockWheel, id: WheelTypes);
|
|
13
|
-
onMouseMoved(): void;
|
|
14
|
-
onMouseOut(): void;
|
|
15
|
-
}
|
|
1
|
+
import { EventHandler } from "./EventHandler.js";
|
|
2
|
+
import { DockWheel } from "./DockWheel.js";
|
|
3
|
+
import { WheelTypes } from "./enums/WheelTypes.js";
|
|
4
|
+
export declare class DockWheelItem {
|
|
5
|
+
wheel: DockWheel;
|
|
6
|
+
id: WheelTypes;
|
|
7
|
+
element: HTMLDivElement;
|
|
8
|
+
hoverIconClass: string;
|
|
9
|
+
mouseOverHandler: EventHandler;
|
|
10
|
+
mouseOutHandler: EventHandler;
|
|
11
|
+
active: boolean;
|
|
12
|
+
constructor(wheel: DockWheel, id: WheelTypes);
|
|
13
|
+
onMouseMoved(): void;
|
|
14
|
+
onMouseOut(): void;
|
|
15
|
+
}
|
package/lib/js/DockWheelItem.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { EventHandler } from "./EventHandler.js";
|
|
2
|
-
export class DockWheelItem {
|
|
3
|
-
constructor(wheel, id) {
|
|
4
|
-
this.wheel = wheel;
|
|
5
|
-
this.id = id;
|
|
6
|
-
let wheelType = id.replace('-s', '');
|
|
7
|
-
this.element = document.createElement('div');
|
|
8
|
-
this.element.classList.add('dock-wheel-item');
|
|
9
|
-
this.element.classList.add('disable-selection');
|
|
10
|
-
this.element.classList.add('dock-wheel-' + wheelType);
|
|
11
|
-
this.element.classList.add('dock-wheel-' + wheelType + '-icon');
|
|
12
|
-
this.hoverIconClass = 'dock-wheel-' + wheelType + '-icon-hover';
|
|
13
|
-
this.mouseOverHandler = new EventHandler(this.element, 'mouseover', this.onMouseMoved.bind(this));
|
|
14
|
-
this.mouseOutHandler = new EventHandler(this.element, 'mouseout', this.onMouseOut.bind(this));
|
|
15
|
-
this.active = false; // Becomes active when the mouse is hovered over it
|
|
16
|
-
}
|
|
17
|
-
onMouseMoved() {
|
|
18
|
-
this.active = true;
|
|
19
|
-
this.element.classList.add(this.hoverIconClass);
|
|
20
|
-
this.wheel.onMouseOver(this);
|
|
21
|
-
}
|
|
22
|
-
onMouseOut() {
|
|
23
|
-
this.active = false;
|
|
24
|
-
this.element.classList.remove(this.hoverIconClass);
|
|
25
|
-
this.wheel.onMouseOut();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
import { EventHandler } from "./EventHandler.js";
|
|
2
|
+
export class DockWheelItem {
|
|
3
|
+
constructor(wheel, id) {
|
|
4
|
+
this.wheel = wheel;
|
|
5
|
+
this.id = id;
|
|
6
|
+
let wheelType = id.replace('-s', '');
|
|
7
|
+
this.element = document.createElement('div');
|
|
8
|
+
this.element.classList.add('dock-wheel-item');
|
|
9
|
+
this.element.classList.add('disable-selection');
|
|
10
|
+
this.element.classList.add('dock-wheel-' + wheelType);
|
|
11
|
+
this.element.classList.add('dock-wheel-' + wheelType + '-icon');
|
|
12
|
+
this.hoverIconClass = 'dock-wheel-' + wheelType + '-icon-hover';
|
|
13
|
+
this.mouseOverHandler = new EventHandler(this.element, 'mouseover', this.onMouseMoved.bind(this));
|
|
14
|
+
this.mouseOutHandler = new EventHandler(this.element, 'mouseout', this.onMouseOut.bind(this));
|
|
15
|
+
this.active = false; // Becomes active when the mouse is hovered over it
|
|
16
|
+
}
|
|
17
|
+
onMouseMoved() {
|
|
18
|
+
this.active = true;
|
|
19
|
+
this.element.classList.add(this.hoverIconClass);
|
|
20
|
+
this.wheel.onMouseOver(this);
|
|
21
|
+
}
|
|
22
|
+
onMouseOut() {
|
|
23
|
+
this.active = false;
|
|
24
|
+
this.element.classList.remove(this.hoverIconClass);
|
|
25
|
+
this.wheel.onMouseOut();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
28
|
//# sourceMappingURL=DockWheelItem.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { FillDockContainer } from "./FillDockContainer.js";
|
|
2
|
-
import { DockManager } from "./DockManager.js";
|
|
3
|
-
import { IState } from "./interfaces/IState.js";
|
|
4
|
-
/**
|
|
5
|
-
* The document manager is then central area of the dock layout hierarchy.
|
|
6
|
-
* This is where more important panels are placed (e.g. the text editor in an IDE,
|
|
7
|
-
* 3D view in a modelling package etc
|
|
8
|
-
*/
|
|
9
|
-
export declare class DocumentManagerContainer extends FillDockContainer {
|
|
10
|
-
minimumAllowedChildNodes: number;
|
|
11
|
-
constructor(dockManager: DockManager);
|
|
12
|
-
private _createDocumentTabPage;
|
|
13
|
-
saveState(state: IState): void;
|
|
14
|
-
/** Returns the selected document tab */
|
|
15
|
-
selectedTab(): import("./TabPage.js").TabPage;
|
|
16
|
-
}
|
|
1
|
+
import { FillDockContainer } from "./FillDockContainer.js";
|
|
2
|
+
import { DockManager } from "./DockManager.js";
|
|
3
|
+
import { IState } from "./interfaces/IState.js";
|
|
4
|
+
/**
|
|
5
|
+
* The document manager is then central area of the dock layout hierarchy.
|
|
6
|
+
* This is where more important panels are placed (e.g. the text editor in an IDE,
|
|
7
|
+
* 3D view in a modelling package etc
|
|
8
|
+
*/
|
|
9
|
+
export declare class DocumentManagerContainer extends FillDockContainer {
|
|
10
|
+
minimumAllowedChildNodes: number;
|
|
11
|
+
constructor(dockManager: DockManager);
|
|
12
|
+
private _createDocumentTabPage;
|
|
13
|
+
saveState(state: IState): void;
|
|
14
|
+
/** Returns the selected document tab */
|
|
15
|
+
selectedTab(): import("./TabPage.js").TabPage;
|
|
16
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { FillDockContainer } from "./FillDockContainer.js";
|
|
2
|
-
import { DocumentTabPage } from "./DocumentTabPage.js";
|
|
3
|
-
import { TabHostDirection } from "./enums/TabHostDirection.js";
|
|
4
|
-
/**
|
|
5
|
-
* The document manager is then central area of the dock layout hierarchy.
|
|
6
|
-
* This is where more important panels are placed (e.g. the text editor in an IDE,
|
|
7
|
-
* 3D view in a modelling package etc
|
|
8
|
-
*/
|
|
9
|
-
export class DocumentManagerContainer extends FillDockContainer {
|
|
10
|
-
constructor(dockManager) {
|
|
11
|
-
super(dockManager, TabHostDirection.TOP);
|
|
12
|
-
this.minimumAllowedChildNodes = 0;
|
|
13
|
-
this.element.classList.add('document-manager');
|
|
14
|
-
this.tabHost.createTabPage = this._createDocumentTabPage;
|
|
15
|
-
this.tabHost.displayCloseButton = true;
|
|
16
|
-
}
|
|
17
|
-
_createDocumentTabPage(tabHost, container) {
|
|
18
|
-
return new DocumentTabPage(tabHost, container);
|
|
19
|
-
}
|
|
20
|
-
saveState(state) {
|
|
21
|
-
super.saveState(state);
|
|
22
|
-
state.documentManager = true;
|
|
23
|
-
}
|
|
24
|
-
/** Returns the selected document tab */
|
|
25
|
-
selectedTab() {
|
|
26
|
-
return this.tabHost.activeTab;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
import { FillDockContainer } from "./FillDockContainer.js";
|
|
2
|
+
import { DocumentTabPage } from "./DocumentTabPage.js";
|
|
3
|
+
import { TabHostDirection } from "./enums/TabHostDirection.js";
|
|
4
|
+
/**
|
|
5
|
+
* The document manager is then central area of the dock layout hierarchy.
|
|
6
|
+
* This is where more important panels are placed (e.g. the text editor in an IDE,
|
|
7
|
+
* 3D view in a modelling package etc
|
|
8
|
+
*/
|
|
9
|
+
export class DocumentManagerContainer extends FillDockContainer {
|
|
10
|
+
constructor(dockManager) {
|
|
11
|
+
super(dockManager, TabHostDirection.TOP);
|
|
12
|
+
this.minimumAllowedChildNodes = 0;
|
|
13
|
+
this.element.classList.add('document-manager');
|
|
14
|
+
this.tabHost.createTabPage = this._createDocumentTabPage;
|
|
15
|
+
this.tabHost.displayCloseButton = true;
|
|
16
|
+
}
|
|
17
|
+
_createDocumentTabPage(tabHost, container) {
|
|
18
|
+
return new DocumentTabPage(tabHost, container);
|
|
19
|
+
}
|
|
20
|
+
saveState(state) {
|
|
21
|
+
super.saveState(state);
|
|
22
|
+
state.documentManager = true;
|
|
23
|
+
}
|
|
24
|
+
/** Returns the selected document tab */
|
|
25
|
+
selectedTab() {
|
|
26
|
+
return this.tabHost.activeTab;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
29
|
//# sourceMappingURL=DocumentManagerContainer.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { TabHost } from "./TabHost.js";
|
|
2
|
-
import { TabPage } from "./TabPage.js";
|
|
3
|
-
import { IDockContainer } from "./interfaces/IDockContainer.js";
|
|
4
|
-
import { PanelContainer } from "./PanelContainer.js";
|
|
5
|
-
/**
|
|
6
|
-
* Specialized tab page that doesn't display the panel's frame when docked in a tab page
|
|
7
|
-
*/
|
|
8
|
-
export declare class DocumentTabPage extends TabPage {
|
|
9
|
-
container: IDockContainer;
|
|
10
|
-
panel: PanelContainer;
|
|
11
|
-
containerElement: HTMLElement;
|
|
12
|
-
constructor(host: TabHost, container: IDockContainer);
|
|
13
|
-
destroy(): void;
|
|
14
|
-
}
|
|
1
|
+
import { TabHost } from "./TabHost.js";
|
|
2
|
+
import { TabPage } from "./TabPage.js";
|
|
3
|
+
import { IDockContainer } from "./interfaces/IDockContainer.js";
|
|
4
|
+
import { PanelContainer } from "./PanelContainer.js";
|
|
5
|
+
/**
|
|
6
|
+
* Specialized tab page that doesn't display the panel's frame when docked in a tab page
|
|
7
|
+
*/
|
|
8
|
+
export declare class DocumentTabPage extends TabPage {
|
|
9
|
+
container: IDockContainer;
|
|
10
|
+
panel: PanelContainer;
|
|
11
|
+
containerElement: HTMLElement;
|
|
12
|
+
constructor(host: TabHost, container: IDockContainer);
|
|
13
|
+
destroy(): void;
|
|
14
|
+
}
|