@lvce-editor/renderer-process 30.46.3 → 30.46.4

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.
@@ -3669,15 +3669,18 @@ const addFileHandle = fileHandle => {
3669
3669
  return addFileHandle$1(fileHandle);
3670
3670
  };
3671
3671
 
3672
+ const getWindowControlsOverlay = () => {
3673
+ const navigatorWithWindowControls = globalThis.navigator;
3674
+ return navigatorWithWindowControls.windowControlsOverlay;
3675
+ };
3676
+ const getTitleBarRect = () => {
3677
+ return getWindowControlsOverlay()?.getTitlebarAreaRect();
3678
+ };
3672
3679
  const getTitleBarHeight = () => {
3673
- if (
3674
- // @ts-expect-error
3675
- globalThis.navigator.windowControlsOverlay?.getTitlebarAreaRect) {
3676
- // @ts-expect-error
3677
- const titleBarRect = globalThis.navigator.windowControlsOverlay.getTitlebarAreaRect();
3678
- return titleBarRect.height;
3679
- }
3680
- return 0;
3680
+ return getTitleBarRect()?.height ?? 0;
3681
+ };
3682
+ const getTitleBarLeftInset = () => {
3683
+ return getTitleBarRect()?.x ?? 0;
3681
3684
  };
3682
3685
  const getBounds = () => {
3683
3686
  return {
@@ -8813,6 +8816,9 @@ const ViewletTitleBarMenuBarEvents = {
8813
8816
  };
8814
8817
 
8815
8818
  const activeId = 'TitleBarEntryActive';
8819
+ const getMenuX = x => {
8820
+ return x + getTitleBarLeftInset();
8821
+ };
8816
8822
  const removeDocumentClickListener = state => {
8817
8823
  const {
8818
8824
  documentClickListener
@@ -8941,7 +8947,7 @@ const openMenu = (state, unFocusIndex, index, level, menuItems, menuFocusedIndex
8941
8947
  items: menuItems,
8942
8948
  level,
8943
8949
  width,
8944
- x,
8950
+ x: getMenuX(x),
8945
8951
  y
8946
8952
  });
8947
8953
  if (menuFocusedIndex !== -1) {
@@ -9008,7 +9014,7 @@ const addMenu = ($$Menus, change, uid) => {
9008
9014
  x,
9009
9015
  y
9010
9016
  } = menu;
9011
- setBounds$a($Menu, x, y, width, height);
9017
+ setBounds$a($Menu, getMenuX(x), y, width, height);
9012
9018
  renderInto($Menu, dom);
9013
9019
  $Menu.id = `Menu-${level}`;
9014
9020
  append$1($Menu);
@@ -9040,7 +9046,7 @@ const updateMenu = ($$Menus, change) => {
9040
9046
  y
9041
9047
  } = menu;
9042
9048
  const $Menu = $$Menus[level];
9043
- setBounds$a($Menu, x, y, width, height);
9049
+ setBounds$a($Menu, getMenuX(x), y, width, height);
9044
9050
  renderInto($Menu, dom);
9045
9051
  const isOpeningSubMenu = $$Menus.length < newLength;
9046
9052
  if (level === newLength - 1 || isOpeningSubMenu) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.46.3",
3
+ "version": "30.46.4",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"