@lvce-editor/main-area-worker 8.11.0 → 8.12.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/dist/mainAreaWorkerMain.js +15 -1
- package/package.json +1 -1
|
@@ -2848,6 +2848,19 @@ const retryOpen = async state => {
|
|
|
2848
2848
|
return openUri(state, tab.uri);
|
|
2849
2849
|
};
|
|
2850
2850
|
|
|
2851
|
+
const rebalanceGroupSizes = groups => {
|
|
2852
|
+
const groupCount = groups.length;
|
|
2853
|
+
if (groupCount === 0) {
|
|
2854
|
+
return [];
|
|
2855
|
+
}
|
|
2856
|
+
const evenSize = Number((100 / groupCount).toFixed(6));
|
|
2857
|
+
const assignedSize = Number((evenSize * (groupCount - 1)).toFixed(6));
|
|
2858
|
+
const lastSize = Number((100 - assignedSize).toFixed(6));
|
|
2859
|
+
return groups.map((group, index) => ({
|
|
2860
|
+
...group,
|
|
2861
|
+
size: index === groupCount - 1 ? lastSize : evenSize
|
|
2862
|
+
}));
|
|
2863
|
+
};
|
|
2851
2864
|
const splitEditorGroup$1 = (state, groupId, direction) => {
|
|
2852
2865
|
const {
|
|
2853
2866
|
layout
|
|
@@ -2887,12 +2900,13 @@ const splitEditorGroup$1 = (state, groupId, direction) => {
|
|
|
2887
2900
|
const sourceIndex = updatedGroups.findIndex(group => group.id === groupId);
|
|
2888
2901
|
reorderedGroups = [...updatedGroups.slice(0, sourceIndex), newGroup, ...updatedGroups.slice(sourceIndex)];
|
|
2889
2902
|
}
|
|
2903
|
+
const resizedGroups = rebalanceGroupSizes(reorderedGroups);
|
|
2890
2904
|
return {
|
|
2891
2905
|
...state,
|
|
2892
2906
|
layout: {
|
|
2893
2907
|
activeGroupId: newGroupId,
|
|
2894
2908
|
direction: newLayoutDirection,
|
|
2895
|
-
groups:
|
|
2909
|
+
groups: resizedGroups
|
|
2896
2910
|
}
|
|
2897
2911
|
};
|
|
2898
2912
|
};
|