picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.69k stars 334 forks source link

NStracking area not updated when moving and resizing control in pixelLayout #2704

Open yd021976 opened 5 days ago

yd021976 commented 5 days ago

Expected Behavior

When moving and resizing a control in a pixelLayout, control "NSTrackingArea" should be updated

Actual Behavior

NSTracking Area is only updated the first time the control is sized or moved. Any later move or resize will never update tracking area. So mouseover and other mouse events doesn't fire correctly (i.e. AS the tracking area does not reflect control size)

Steps to Reproduce the Problem

See the bunch of code below. Each time I call the show method, I compute random location and size for Button control (to make it simpler). First time the method is called, everything is OK because NSTracking area is correctly initialized with the size of the button control. Any further calls will resize et re-position buttons control => NStracking area is still seated to the first size of button control and is never updated. So some controls have bad area to track mouse move/enter/leave.

Code that Demonstrates the Problem

 public class CRadialControl : PixelLayout
    {
...
 public void show(int startAngle = 0)
        {
            Visible = true;
            var currX = 50; // Start of random X

            for (var i = 0; i < 8; i++)
            {
                var _graphicsPath = new GraphicsPath();
                var sectorDrawer = new ArcSectorDrawer();

                // Will compute size and location of controls
                var size = new Size(new Random().Next(50, 90), new Random().Next(50, 90));
                var location = new Point(new Random().Next(currX, currX+90), (level + 1) * 200);
                currX += 100+size.Width;

                // Get the control by Index in dictionary property
                var ctrl = layoutBtns.ElementAt(i).Key;

                 // Move and resize control in pixel layout
                Move(ctrl, location.X, location.Y);
                ctrl.Size = size;
            }
        }

Specifications

yd021976 commented 5 days ago

FYI, I found what's is wrong, and potentially a bug. As soon as the control (i.e. In my case the pixelLayout control) is set to Visible=false somewhere in the code, when I change size of container (PixelLayout) controls, NSTrackingArea is never updated (the location is OK, and the Size property of ETO Objects are right too)

As a workaround, I don't use Visible property but use native "AlphaValue" to hide PixelLayout object.

I think there is a bug.