Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yd021976 opened this issue Nov 24, 2024 · 3 comments
Open

Comments

@yd021976
Copy link

yd021976 commented Nov 24, 2024

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

  • Version: 2.8.0.0 (Provided by McNeel Rhinoceros)
  • Platform(s): macOS
  • Operating System(s): macOS 15.1
@yd021976
Copy link
Author

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.

@cwensley
Copy link
Member

Hey @yd021976, thanks for reporting the issue. Do you have some details of when you set PixelLayout.Visible=false? Do you set it to false, update positions of things, then set Visible = true?

A more complete sample might help shed some light on how to reproduce this on my end. Thanks!

@yd021976
Copy link
Author

Hi ! My bad, I was sure I updates the exemple code . Anyway, I reproduced the bug with and without « visible » property. As soon as you randomly resize a control, the tracking are ends up to not be updated.
If I have time, I’ll update the example code to reproduce.
Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants