Skip to content

Commit d8222c2

Browse files
committed
[macos] Fixed setSize coordinate error.
1 parent 9adf0cd commit d8222c2

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.1
2+
3+
- [macos] Fixed `setSize` coordinate error.
4+
15
## 0.1.0
26

37
- Implemented `isResizable`, `setResizable` Methods.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Add this to your package's pubspec.yaml file:
4848

4949
```yaml
5050
dependencies:
51-
window_manager: ^0.1.0
51+
window_manager: ^0.1.1
5252
```
5353
5454
Or

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ packages:
169169
path: ".."
170170
relative: true
171171
source: path
172-
version: "0.1.0"
172+
version: "0.1.1"
173173
sdks:
174174
dart: ">=2.12.0 <3.0.0"
175175
flutter: ">=1.20.0"

macos/Classes/WindowManager.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,13 @@ public class WindowManager: NSObject, NSWindowDelegate {
216216

217217
var frameRect = mainWindow.frame
218218
if (args["width"] != nil && args["height"] != nil) {
219-
frameRect.size.width = CGFloat(truncating: args["width"] as! NSNumber)
220-
frameRect.size.height = CGFloat(truncating: args["height"] as! NSNumber)
219+
let width: CGFloat = CGFloat(truncating: args["width"] as! NSNumber)
220+
let height: CGFloat = CGFloat(truncating: args["height"] as! NSNumber)
221+
222+
frameRect.origin.y += (frameRect.size.height - height)
223+
frameRect.size.width = width
224+
frameRect.size.height = height
225+
221226
}
222227

223228
if (animate) {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: window_manager
22
description: This plugin allows Flutter desktop apps to resizing and repositioning the window.
3-
version: 0.1.0
3+
version: 0.1.1
44
homepage: https://github.com/leanflutter/window_manager
55

66
environment:

0 commit comments

Comments
 (0)