@lvce-editor/activity-bar-worker 1.7.0 → 1.9.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 +36 -25
- package/package.json +1 -1
|
@@ -1073,6 +1073,10 @@ const Home = 12;
|
|
|
1073
1073
|
const UpArrow = 14;
|
|
1074
1074
|
const DownArrow = 16;
|
|
1075
1075
|
|
|
1076
|
+
const ActivityBar$3 = 1;
|
|
1077
|
+
const Settings$1 = 12;
|
|
1078
|
+
const ActivityBarAdditionalViews = 17;
|
|
1079
|
+
|
|
1076
1080
|
const LeftClick = 0;
|
|
1077
1081
|
|
|
1078
1082
|
const DebugWorker = 55;
|
|
@@ -1127,23 +1131,15 @@ const handleBlur = state => {
|
|
|
1127
1131
|
};
|
|
1128
1132
|
};
|
|
1129
1133
|
|
|
1130
|
-
const getIndexFromPosition = (eventX, eventY, itemHeight, itemCount) => {
|
|
1131
|
-
const
|
|
1134
|
+
const getIndexFromPosition = (y, eventX, eventY, itemHeight, itemCount) => {
|
|
1135
|
+
const relativeY = eventY - y;
|
|
1136
|
+
const index = Math.floor(relativeY / itemHeight);
|
|
1132
1137
|
if (index < 0 || index >= itemCount) {
|
|
1133
1138
|
return -1;
|
|
1134
1139
|
}
|
|
1135
1140
|
return index;
|
|
1136
1141
|
};
|
|
1137
1142
|
|
|
1138
|
-
const show = async (x, y, id, ...args) => {
|
|
1139
|
-
// TODO
|
|
1140
|
-
};
|
|
1141
|
-
|
|
1142
|
-
const handleClickAdditionalViews = async (state, x, y, viewletId) => {
|
|
1143
|
-
await show();
|
|
1144
|
-
return state;
|
|
1145
|
-
};
|
|
1146
|
-
|
|
1147
1143
|
const rpcs = Object.create(null);
|
|
1148
1144
|
const set$2 = (id, rpc) => {
|
|
1149
1145
|
rpcs[id] = rpc;
|
|
@@ -1531,6 +1527,15 @@ const RendererWorker = {
|
|
|
1531
1527
|
writeClipBoardText
|
|
1532
1528
|
};
|
|
1533
1529
|
|
|
1530
|
+
const show = async (x, y, id, ...args) => {
|
|
1531
|
+
await showContextMenu(x, y, id, args);
|
|
1532
|
+
};
|
|
1533
|
+
|
|
1534
|
+
const handleClickAdditionalViews = async (state, x, y, viewletId) => {
|
|
1535
|
+
await show(x, y, ActivityBarAdditionalViews);
|
|
1536
|
+
return state;
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1534
1539
|
const {
|
|
1535
1540
|
set,
|
|
1536
1541
|
invoke
|
|
@@ -1558,7 +1563,7 @@ const handleClickOther = async (state, x, y, viewletId) => {
|
|
|
1558
1563
|
};
|
|
1559
1564
|
|
|
1560
1565
|
const handleClickSettings = async (state, x, y, viewletId) => {
|
|
1561
|
-
await show();
|
|
1566
|
+
await show(x, y, Settings$1);
|
|
1562
1567
|
return state;
|
|
1563
1568
|
};
|
|
1564
1569
|
|
|
@@ -1566,35 +1571,36 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1566
1571
|
if (button !== LeftClick) {
|
|
1567
1572
|
return state;
|
|
1568
1573
|
}
|
|
1569
|
-
const {
|
|
1570
|
-
activityBarItems
|
|
1571
|
-
} = state;
|
|
1572
1574
|
if (index === -1) {
|
|
1573
1575
|
return state;
|
|
1574
1576
|
}
|
|
1577
|
+
const {
|
|
1578
|
+
activityBarItems
|
|
1579
|
+
} = state;
|
|
1575
1580
|
const item = activityBarItems[index];
|
|
1576
1581
|
const viewletId = item.id;
|
|
1577
1582
|
switch (viewletId) {
|
|
1578
1583
|
case 'Settings':
|
|
1579
|
-
return handleClickSettings(state);
|
|
1584
|
+
return handleClickSettings(state, x, y);
|
|
1580
1585
|
case 'Additional Views':
|
|
1581
|
-
return handleClickAdditionalViews(state);
|
|
1586
|
+
return handleClickAdditionalViews(state, x, y);
|
|
1582
1587
|
default:
|
|
1583
1588
|
return handleClickOther(state, x, y, viewletId);
|
|
1584
1589
|
}
|
|
1585
1590
|
};
|
|
1586
1591
|
|
|
1587
|
-
const handleClick = async (state, button,
|
|
1592
|
+
const handleClick = async (state, button, eventX, eventY) => {
|
|
1588
1593
|
const {
|
|
1589
1594
|
activityBarItems,
|
|
1590
|
-
itemHeight
|
|
1595
|
+
itemHeight,
|
|
1596
|
+
y
|
|
1591
1597
|
} = state;
|
|
1592
|
-
const index = getIndexFromPosition(
|
|
1593
|
-
return handleClickIndex(state, button, index,
|
|
1598
|
+
const index = getIndexFromPosition(y, eventX, eventY, itemHeight, activityBarItems.length);
|
|
1599
|
+
return handleClickIndex(state, button, index, eventX, eventY);
|
|
1594
1600
|
};
|
|
1595
1601
|
|
|
1596
1602
|
const handleContextMenu = async (state, button, x, y) => {
|
|
1597
|
-
await show();
|
|
1603
|
+
await show(x, y, ActivityBar$3);
|
|
1598
1604
|
return state;
|
|
1599
1605
|
};
|
|
1600
1606
|
|
|
@@ -1612,7 +1618,10 @@ const findIndex = (activityBarItems, id) => {
|
|
|
1612
1618
|
};
|
|
1613
1619
|
|
|
1614
1620
|
const handleSideBarViewletChange = (state, id, ...args) => {
|
|
1615
|
-
const
|
|
1621
|
+
const {
|
|
1622
|
+
activityBarItems
|
|
1623
|
+
} = state;
|
|
1624
|
+
const index = findIndex(activityBarItems, id);
|
|
1616
1625
|
return {
|
|
1617
1626
|
...state,
|
|
1618
1627
|
selectedIndex: index
|
|
@@ -1730,7 +1739,8 @@ const loadContent = async (state, savedState) => {
|
|
|
1730
1739
|
const items = getActivityBarItems();
|
|
1731
1740
|
return {
|
|
1732
1741
|
...state,
|
|
1733
|
-
activityBarItems: items
|
|
1742
|
+
activityBarItems: items,
|
|
1743
|
+
sideBarVisible: true
|
|
1734
1744
|
};
|
|
1735
1745
|
};
|
|
1736
1746
|
|
|
@@ -1938,7 +1948,8 @@ const renderEventListeners = () => {
|
|
|
1938
1948
|
params: ['handleFocus']
|
|
1939
1949
|
}, {
|
|
1940
1950
|
name: HandleContextMenu,
|
|
1941
|
-
params: ['handleContextMenu', Button$1, ClientX, ClientY]
|
|
1951
|
+
params: ['handleContextMenu', Button$1, ClientX, ClientY],
|
|
1952
|
+
preventDefault: true
|
|
1942
1953
|
}, {
|
|
1943
1954
|
name: HandleMouseDown,
|
|
1944
1955
|
params: ['handleClick', Button$1, ClientX, ClientY],
|