mirror of
https://github.com/cyanfish/naps2.git
synced 2024-10-26 09:01:36 +03:00
Mac: Don't depend on ClipRectangle
Starting in macOS 14 there is a new clipsToBounds property that defaults to false, which is a behavior change. This causes incompatibilities with anything that uses ClipRectangle directly or indirectly. https://developer.apple.com/documentation/macos-release-notes/appkit-release-notes-for-macos-14#NSView #227
This commit is contained in:
parent
42b6bdbb29
commit
1f0e529ca8
@ -57,10 +57,10 @@ public class CloseButton : Drawable
|
||||
|
||||
private void OnPaint(object? sender, PaintEventArgs e)
|
||||
{
|
||||
var clearColor = _active && _hover ? ActiveBackground : _hover ? HoverBackground : DefaultBackground;
|
||||
e.Graphics.Clear(clearColor);
|
||||
var w = e.ClipRectangle.Width;
|
||||
var h = e.ClipRectangle.Height;
|
||||
var bgColor = _active && _hover ? ActiveBackground : _hover ? HoverBackground : DefaultBackground;
|
||||
var w = Width;
|
||||
var h = Height;
|
||||
e.Graphics.FillRectangle(bgColor, 0, 0, w, h);
|
||||
var p = CLOSE_BUTTON_PADDING;
|
||||
var pen = new Pen(PenColor, 3);
|
||||
e.Graphics.DrawLine(pen, p - 1, p - 1, w - p, h - p);
|
||||
|
@ -99,23 +99,24 @@ public abstract class NotificationView : IDisposable
|
||||
|
||||
private void DrawableOnPaint(object? sender, PaintEventArgs e)
|
||||
{
|
||||
var w = e.ClipRectangle.Width;
|
||||
var h = e.ClipRectangle.Height;
|
||||
var drawable = (Drawable) sender!;
|
||||
var w = drawable.Width;
|
||||
var h = drawable.Height;
|
||||
e.Graphics.FillRectangle(BackgroundColor, 0, 0, w, h);
|
||||
e.Graphics.DrawRectangle(BorderColor, 0, 0, w - 1, h - 1);
|
||||
}
|
||||
|
||||
private void DrawWithRoundedCorners(PaintEventArgs e)
|
||||
private void DrawWithRoundedCorners(Drawable drawable, PaintEventArgs e)
|
||||
{
|
||||
// TODO: We're not using this as the few pixels on the edges aren't transparent, which is a problem if there's
|
||||
// an image underneath. Not sure if there's a way to make that work but I don't care enough about rounded
|
||||
// corners at the moment.
|
||||
var w = e.ClipRectangle.Width;
|
||||
var h = e.ClipRectangle.Height;
|
||||
var w = drawable.Width;
|
||||
var h = drawable.Height;
|
||||
var r = BORDER_RADIUS;
|
||||
var d = r * 2;
|
||||
var q = r / 2;
|
||||
e.Graphics.Clear(Manager!.ColorScheme.BackgroundColor);
|
||||
e.Graphics.FillRectangle(Manager!.ColorScheme.BackgroundColor, 0, 0, w, h);
|
||||
// Corners
|
||||
e.Graphics.FillEllipse(BackgroundColor, -1, -1, d, d);
|
||||
e.Graphics.FillEllipse(BackgroundColor, w - d, -1, d, d);
|
||||
|
@ -102,8 +102,8 @@ public class ScrollZoomImageViewer
|
||||
|
||||
private void ImagePaint(object? sender, PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SetClip(e.ClipRectangle);
|
||||
e.Graphics.Clear(ColorScheme?.BackgroundColor ?? Colors.White);
|
||||
var bgColor = ColorScheme?.BackgroundColor ?? Colors.White;
|
||||
e.Graphics.FillRectangle(bgColor, 0, 0, _imageView.Width, _imageView.Height);
|
||||
if (Image != null)
|
||||
{
|
||||
e.Graphics.DrawRectangle(
|
||||
|
Loading…
Reference in New Issue
Block a user