@lvce-editor/activity-bar-worker 1.7.0 → 1.8.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/activityBarWorkerMain.js +13 -10
- package/package.json +1 -1
|
@@ -1127,8 +1127,9 @@ const handleBlur = state => {
|
|
|
1127
1127
|
};
|
|
1128
1128
|
};
|
|
1129
1129
|
|
|
1130
|
-
const getIndexFromPosition = (eventX, eventY, itemHeight, itemCount) => {
|
|
1131
|
-
const
|
|
1130
|
+
const getIndexFromPosition = (y, eventX, eventY, itemHeight, itemCount) => {
|
|
1131
|
+
const relativeY = eventY - y;
|
|
1132
|
+
const index = Math.floor(relativeY / itemHeight);
|
|
1132
1133
|
if (index < 0 || index >= itemCount) {
|
|
1133
1134
|
return -1;
|
|
1134
1135
|
}
|
|
@@ -1566,12 +1567,12 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1566
1567
|
if (button !== LeftClick) {
|
|
1567
1568
|
return state;
|
|
1568
1569
|
}
|
|
1569
|
-
const {
|
|
1570
|
-
activityBarItems
|
|
1571
|
-
} = state;
|
|
1572
1570
|
if (index === -1) {
|
|
1573
1571
|
return state;
|
|
1574
1572
|
}
|
|
1573
|
+
const {
|
|
1574
|
+
activityBarItems
|
|
1575
|
+
} = state;
|
|
1575
1576
|
const item = activityBarItems[index];
|
|
1576
1577
|
const viewletId = item.id;
|
|
1577
1578
|
switch (viewletId) {
|
|
@@ -1584,13 +1585,14 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1584
1585
|
}
|
|
1585
1586
|
};
|
|
1586
1587
|
|
|
1587
|
-
const handleClick = async (state, button,
|
|
1588
|
+
const handleClick = async (state, button, eventX, eventY) => {
|
|
1588
1589
|
const {
|
|
1589
1590
|
activityBarItems,
|
|
1590
|
-
itemHeight
|
|
1591
|
+
itemHeight,
|
|
1592
|
+
y
|
|
1591
1593
|
} = state;
|
|
1592
|
-
const index = getIndexFromPosition(
|
|
1593
|
-
return handleClickIndex(state, button, index,
|
|
1594
|
+
const index = getIndexFromPosition(y, eventX, eventY, itemHeight, activityBarItems.length);
|
|
1595
|
+
return handleClickIndex(state, button, index, eventX, eventY);
|
|
1594
1596
|
};
|
|
1595
1597
|
|
|
1596
1598
|
const handleContextMenu = async (state, button, x, y) => {
|
|
@@ -1730,7 +1732,8 @@ const loadContent = async (state, savedState) => {
|
|
|
1730
1732
|
const items = getActivityBarItems();
|
|
1731
1733
|
return {
|
|
1732
1734
|
...state,
|
|
1733
|
-
activityBarItems: items
|
|
1735
|
+
activityBarItems: items,
|
|
1736
|
+
sideBarVisible: true
|
|
1734
1737
|
};
|
|
1735
1738
|
};
|
|
1736
1739
|
|