@geode/opengeodeweb-front 10.13.2-rc.1 → 10.13.2-rc.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.
|
@@ -11,10 +11,17 @@ const GAP_WIDTH = 10;
|
|
|
11
11
|
const PERCENT_100 = 100;
|
|
12
12
|
|
|
13
13
|
const TOTAL_PERCENT = 100;
|
|
14
|
+
const MAX_PANEL_WIDTH_RATIO = 0.8;
|
|
15
|
+
|
|
16
|
+
const { containerWidth } = defineProps({
|
|
17
|
+
containerWidth: { type: Number, required: true },
|
|
18
|
+
});
|
|
14
19
|
|
|
15
20
|
const treeviewStore = useTreeviewStore();
|
|
16
21
|
const emit = defineEmits(["show-menu"]);
|
|
17
22
|
|
|
23
|
+
const maxWidth = computed(() => containerWidth * MAX_PANEL_WIDTH_RATIO);
|
|
24
|
+
|
|
18
25
|
const mainView = computed(() => treeviewStore.opened_views[0]);
|
|
19
26
|
const additionalViews = computed(() => treeviewStore.opened_views.slice(1));
|
|
20
27
|
|
|
@@ -41,6 +48,28 @@ watch(
|
|
|
41
48
|
{ immediate: true },
|
|
42
49
|
);
|
|
43
50
|
|
|
51
|
+
watch(maxWidth, (newMax) => {
|
|
52
|
+
const hasAdditional = additionalViews.value.length > 0;
|
|
53
|
+
const gap = hasAdditional ? GAP_WIDTH : 0;
|
|
54
|
+
const total =
|
|
55
|
+
treeviewStore.panelWidth + (hasAdditional ? treeviewStore.additionalPanelWidth : 0) + gap;
|
|
56
|
+
|
|
57
|
+
if (total > newMax) {
|
|
58
|
+
if (hasAdditional) {
|
|
59
|
+
const newAdditionalWidth = newMax - treeviewStore.panelWidth - gap;
|
|
60
|
+
if (newAdditionalWidth < WIDTH_MIN) {
|
|
61
|
+
treeviewStore.setAdditionalPanelWidth(WIDTH_MIN);
|
|
62
|
+
const newMainWidth = newMax - WIDTH_MIN - gap;
|
|
63
|
+
treeviewStore.setPanelWidth(Math.max(WIDTH_MIN, newMainWidth));
|
|
64
|
+
} else {
|
|
65
|
+
treeviewStore.setAdditionalPanelWidth(newAdditionalWidth);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
treeviewStore.setPanelWidth(Math.max(WIDTH_MIN, newMax));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
44
73
|
function onDragStart(index) {
|
|
45
74
|
draggedIndex.value = index;
|
|
46
75
|
}
|
|
@@ -61,8 +90,15 @@ function onResizeStart(event) {
|
|
|
61
90
|
const startX = event.clientX;
|
|
62
91
|
function resize(move_event) {
|
|
63
92
|
const deltaX = move_event.clientX - startX;
|
|
64
|
-
|
|
65
|
-
|
|
93
|
+
let newWidth = Math.max(WIDTH_MIN, startWidth + deltaX);
|
|
94
|
+
const hasAdditional = additionalViews.value.length > 0;
|
|
95
|
+
const gap = hasAdditional ? GAP_WIDTH : 0;
|
|
96
|
+
const currentTotalWidth =
|
|
97
|
+
newWidth + (hasAdditional ? treeviewStore.additionalPanelWidth : 0) + gap;
|
|
98
|
+
if (currentTotalWidth > maxWidth.value) {
|
|
99
|
+
newWidth = maxWidth.value - (hasAdditional ? treeviewStore.additionalPanelWidth : 0) - gap;
|
|
100
|
+
}
|
|
101
|
+
treeviewStore.setPanelWidth(Math.max(WIDTH_MIN, newWidth));
|
|
66
102
|
document.body.style.userSelect = "none";
|
|
67
103
|
}
|
|
68
104
|
function stopResize() {
|
|
@@ -79,8 +115,12 @@ function onAdditionalResizeStart(event) {
|
|
|
79
115
|
const startX = event.clientX;
|
|
80
116
|
function resize(move_event) {
|
|
81
117
|
const deltaX = move_event.clientX - startX;
|
|
82
|
-
|
|
83
|
-
treeviewStore.
|
|
118
|
+
let newWidth = Math.max(WIDTH_MIN, startWidth + deltaX);
|
|
119
|
+
const currentTotalWidth = treeviewStore.panelWidth + newWidth + GAP_WIDTH;
|
|
120
|
+
if (currentTotalWidth > maxWidth.value) {
|
|
121
|
+
newWidth = maxWidth.value - treeviewStore.panelWidth - GAP_WIDTH;
|
|
122
|
+
}
|
|
123
|
+
treeviewStore.setAdditionalPanelWidth(Math.max(WIDTH_MIN, newWidth));
|
|
84
124
|
document.body.style.userSelect = "none";
|
|
85
125
|
}
|
|
86
126
|
function stopResize() {
|
|
@@ -44,7 +44,10 @@ defineExpose({ get_viewer_id });
|
|
|
44
44
|
</script>
|
|
45
45
|
|
|
46
46
|
<template>
|
|
47
|
-
<ViewerObjectTreeLayout
|
|
47
|
+
<ViewerObjectTreeLayout
|
|
48
|
+
:container-width="containerWidth"
|
|
49
|
+
@show-menu="(args) => emit('show-menu', args)"
|
|
50
|
+
/>
|
|
48
51
|
<ViewerContextMenu
|
|
49
52
|
v-if="displayMenu"
|
|
50
53
|
:id="menuStore.current_id"
|
package/package.json
CHANGED