Skip to content

Commit

Permalink
proportionalFromIssue562
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Aug 22, 2024
1 parent 79f83b9 commit e17090a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 50 additions & 1 deletion Chapters/bloc/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -915,4 +915,53 @@ aContainer := BlElement new
aContainer openInNewSpace.
```

![Frame layout](figures/proportionalLayout.png)
![Frame layout](figures/proportionalLayout.png)




### Proportional layout

This section should reevaluated - it is a copy and paste from an issue
[https://github.com/pharo-graphics/Bloc/issues/562](https://github.com/pharo-graphics/Bloc/issues/562)

```
gap:= 20.
BlElement new
constraintsDo: [ :constraints |
constraints horizontal exact: 400.
constraints vertical exact: 300.
constraints padding: (BlInsets all: gap) ];
background: Color red;
id: #A;
layout: BlProportionalLayout new;
addChildren: {
(BlElement new
constraintsDo: [ :constraints |
constraints proportional vertical bottom: 0.5.
constraints margin: (BlInsets all: gap) ];
id: #B;
background: Color green;
yourself).
(BlElement new
constraintsDo: [ :constraints |
constraints proportional horizontal right: 0.5.
constraints proportional vertical top: 0.5.
constraints margin: (BlInsets all: gap) ];
id: #C;
background: Color blue;
yourself).
(BlElement new
constraintsDo: [ :constraints |
constraints proportional horizontal left: 0.5.
constraints proportional vertical top: 0.5.
constraints margin: (BlInsets all: gap) ];
id: #D;
background: Color yellow;
yourself) };
yourself
```

![Proportional layout from issue 562](figures/proportionalFromIssue562.png)

0 comments on commit e17090a

Please sign in to comment.