mirror of
https://github.com/tauri-apps/tao.git
synced 2026-01-31 00:35:16 +01:00
fix(macos/menu): set native image height to 18 (#746)
* fix(macos/menu): set native image height to 18 closes https://github.com/tauri-apps/tauri/issues/7077 * Update menu.rs
This commit is contained in:
5
.changes/macos-native-image-menu.md
Normal file
5
.changes/macos-native-image-menu.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tao": "patch"
|
||||
---
|
||||
|
||||
On macOS, force `NativeImage` height to be `18` to have consistent size for all icons and match custom icons.
|
||||
@@ -109,9 +109,11 @@ impl MenuItemAttributes {
|
||||
// Available only with CustomMenuItemExtMacOS
|
||||
pub fn set_native_image(&mut self, icon: NativeImage) {
|
||||
unsafe {
|
||||
let ns_image: id = icon.get_ns_image();
|
||||
let image_ref: id = msg_send![class!(NSImage), imageNamed: ns_image];
|
||||
let () = msg_send![self.1, setImage: image_ref];
|
||||
let named_img: id = icon.get_ns_image();
|
||||
let nsimage: id = msg_send![class!(NSImage), imageNamed: named_img];
|
||||
let size = NSSize::new(18.0, 18.0);
|
||||
let _: () = msg_send![nsimage, setSize: size];
|
||||
let _: () = msg_send![self.1, setImage: nsimage];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user