Skip to content

Circle layers have wrong selection area #442

Closed

Description

@zozorg

Synfig version & platform:
linux 1.3.4

Issue description:
A circle layer can be selected by clicking on its right at any distance. It makes circles of low Z depth so annoying you have to deactivate them.

Activity

  1. zeograd commented on Oct 15, 2017

    @zeograd

    It seems like CurveArray::intersect(Real, Real, Point*) (in layer_shape.cpp:525)
    starts with

    	if((y < aabb.miny) || (y > aabb.maxy) || (x < aabb.minx)) return 0;
    

    while it should rather be

    	if((y < aabb.miny) || (y > aabb.maxy) || (x < aabb.minx) || (x > aabb.maxx)) return 0;
    

    Note that doing so still allow to incorrectly select a circle in the 2 right areas between the actual curve and its AABB due to intersect_conic matching twice in the special degenerate accept case in layer_shape.cpp:241

    	//degenerate accept - to the right and crossing the base line
    	if(x > xmax)
    	{
    		return (y <= ymax && y >= ymin);
    	}
    

    The fact that the degenerate accept case of intersect_conic matches for x > xmax makes sense that the calling intersect function did NOT checked x vs aabb.maxx but I don't understand the usefulness of the degenerate accept case for now (probably too broad as it is written now)

  2. added a commit that references this issue on Oct 20, 2017
  3. morevnaproject commented on Oct 20, 2017

    @morevnaproject
    Member

    Thank you @zeograd! This is already better than before! I have committed your fix.

  4. zeograd commented on Oct 20, 2017

    @zeograd

    You're welcome. I hoped I could do better but digging into a 12 years old function filled by conic maths without a good knowledge of the rest of synfig was a bit daunting.

  5. morevnaproject commented on Oct 26, 2017

    @morevnaproject
    Member

    I found that this bug was introduced in c6f7457 and 2fbdbcf when Circle Layer was rewritten to use Layer Shape. For some reason Layer Shape doesn't parse hit_check() function for this case correctly.

    I have added explicit hit_check() function as a workaround. Closed via 38c383b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions