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

BlCircleGeometry and BlSquareGeometry do not have the same drawing logic #571

Open
Nyan11 opened this issue Aug 2, 2024 · 2 comments
Open

Comments

@Nyan11
Copy link
Contributor

Nyan11 commented Aug 2, 2024

Hello,

I was playing with the Geometry and discover that BlCircleGeometry and BlSquareGeometry are a bit confusing.

In both example i create a rectangle shape (size := 200 @ 20) and put square and circle geometry inside.
We can see that the square element is drawn in the middle of it's bound while the circle geometry is drawn on the left side.

example with square

BlElement new
   background: (BlPaintBackground new
         paint: (BlColorPaint new
               color: (Color r: 0.844574780058651 g: 0.3841642228739003 b: 0.6852394916911045 alpha: 1.0);
               yourself);
         opacity: 1.0;
         yourself);
   clipChildren: false;
   constraintsDo: [:constraints |  constraints horizontal exact: 200.0.
      constraints vertical exact: 200.0 ];
   layout: BlFrameLayout new;
   addChildren: {(BlElement new
         background: (BlPaintBackground new
               paint: (BlColorPaint new
                     color: (Color r: 0.9110459433040078 g: 0.8836754643206256 b: 0.16911045943304007 alpha: 1.0);
                     yourself);
               opacity: 1.0;
               yourself);
         border: (BlBorderBuilder new
               paint: (BlColorPaint new
                     color: (Color r: 0.0 g: 0.0 b: 0.0 alpha: 1.0);
                     yourself);
               build);
         geometry: BlSquareGeometry new;
         constraintsDo: [:constraints |  constraints horizontal exact: 200.0.
            constraints vertical exact: 20.0.
            constraints frame horizontal alignCenter.
            constraints frame vertical alignCenter ];
         id: #A;
         yourself)};
   id: #group;
   openInNewSpace

image

example with circle

BlElement new
   background: (BlPaintBackground new
         paint: (BlColorPaint new
               color: (Color r: 0.844574780058651 g: 0.3841642228739003 b: 0.6852394916911045 alpha: 1.0);
               yourself);
         opacity: 1.0;
         yourself);
   clipChildren: false;
   constraintsDo: [:constraints |  constraints horizontal exact: 200.0.
      constraints vertical exact: 200.0 ];
   layout: BlFrameLayout new;
   addChildren: {(BlElement new
         background: (BlPaintBackground new
               paint: (BlColorPaint new
                     color: (Color r: 0.9110459433040078 g: 0.8836754643206256 b: 0.16911045943304007 alpha: 1.0);
                     yourself);
               opacity: 1.0;
               yourself);
         border: (BlBorderBuilder new
               paint: (BlColorPaint new
                     color: (Color r: 0.0 g: 0.0 b: 0.0 alpha: 1.0);
                     yourself);
               build);
         geometry: BlCircleGeometry new;
         constraintsDo: [:constraints |  constraints horizontal exact: 200.0.
            constraints vertical exact: 20.0.
            constraints frame horizontal alignCenter.
            constraints frame vertical alignCenter ];
         id: #A;
         yourself)};
   id: #group;
   openInNewSpace

image

@Nyan11
Copy link
Contributor Author

Nyan11 commented Aug 2, 2024

In this example, i only open the element in space and it works fine.

circle

(element := BlElement new
   background: (BlPaintBackground new
         paint: (BlColorPaint new
               color: (Color r: 0.9110459433040078 g: 0.8836754643206256 b: 0.16911045943304007 alpha: 1.0);
               yourself);
         opacity: 1.0;
         yourself);
   border: (BlBorderBuilder new
         paint: (BlColorPaint new
               color: (Color r: 0.0 g: 0.0 b: 0.0 alpha: 1.0);
               yourself);
         build);
   geometry: BlCircleGeometry new;
   constraintsDo: [:constraints |  constraints horizontal exact: 200.0.
			constraints horizontal exact: 20.0.
      ];
   id: #A;
   openInSpace) extent: 200 asPoint.

image

square

(element := BlElement new
   background: (BlPaintBackground new
         paint: (BlColorPaint new
               color: (Color r: 0.9110459433040078 g: 0.8836754643206256 b: 0.16911045943304007 alpha: 1.0);
               yourself);
         opacity: 1.0;
         yourself);
   border: (BlBorderBuilder new
         paint: (BlColorPaint new
               color: (Color r: 0.0 g: 0.0 b: 0.0 alpha: 1.0);
               yourself);
         build);
   geometry: BlSquareGeometry new;
   constraintsDo: [:constraints |  constraints horizontal exact: 200.0.
			constraints horizontal exact: 20.0.
      ];
   id: #A;
   openInSpace) extent: 200 asPoint.

image

@Nyan11
Copy link
Contributor Author

Nyan11 commented Aug 2, 2024

In this example the beahviour are differents

BlElement new
   clipChildren: false;
   addChildren: {(BlElement new
         background: Color green;
         border: (BlBorderBuilder new
               paint: Color black;
               build);
         geometry: BlCircleGeometry new;
         constraintsDo: [:constraints |  constraints horizontal exact: 200.0.
            constraints vertical exact: 20.0.
            constraints frame horizontal alignCenter.
            constraints frame vertical alignCenter ];
         id: #circle;
         yourself) . 
      (BlElement new
         background: Color green;
         border: (BlBorderBuilder new
               paint: Color black;
               build);
         geometry: BlSquareGeometry new;
         constraintsDo: [:constraints |  constraints horizontal exact: 200.0.
            constraints vertical exact: 20.0.
            constraints position: 0 @ 20 ];
         id: #square;
         yourself)};
   id: #group;
   openInSpace

image

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

1 participant