Skip to content

Commit 9b83785

Browse files
committed
fix: drop and drop window overlaps mac titlebar in some macs
1 parent 30baf21 commit 9b83785

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/assets/default-project/en/Newly_added_features.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ We are continuously adding features every week to improve the life of web develo
77

88
Here's a list of top features recently added to Phoenix:
99

10-
## Drag and Drop Files and Folders in Desktop Apps
10+
## Drag and Drop Files and Folders in Desktop Apps - Experimental
1111

1212
`Added on June, 2024`
1313

src/utils/DragAndDrop.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,14 @@ define(function (require, exports, module) {
207207
});
208208
}
209209

210-
const MAC_TITLE_BAR_HEIGHT = 28;
211210
async function _computeNewPositionAndSizeWebkit() {
212211
const currentWindow = window.__TAURI__.window.getCurrent();
213212
const newSize = await currentWindow.innerSize();
214213
const newPosition = await currentWindow.innerPosition();
215-
if(Phoenix.platform === "mac") {
216-
// in mac we somehow get the top left of the window including the title bar even though we are calling the
217-
// tauri innerPosition api. So we just adjust for a generally constant title bar height of mac that is 28px.
218-
newPosition.y = newPosition.y + MAC_TITLE_BAR_HEIGHT;
219-
newSize.height = newSize.height - MAC_TITLE_BAR_HEIGHT;
220-
}
214+
// in mac we somehow get the top left of the window including the title bar even though we are calling the
215+
// tauri innerPosition api. We earlier adjusted for a generally constant title bar height of mac that is 28px.
216+
// But then is nome macs due to display scaling, it was not 28px all the time.
217+
// so, we just draw over the entire window in mac alone.
221218
return {newSize, newPosition};
222219
}
223220

0 commit comments

Comments
 (0)