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

docs: Remove PositionType from the docs #3198

Merged
merged 3 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions doc/flame/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,37 +360,6 @@ void onDragUpdate(DragUpdateInfo info) {
```


### PositionType

```{note}
If you are using the `CameraComponent` you should not use `PositionType`, but
instead adding your components directly to the viewport for example if you
want to use them as a HUD.
```

If you want to create a HUD (Head-up display) or another component that isn't positioned in relation
to the game coordinates, you can change the `PositionType` of the component.
The default `PositionType` is `positionType = PositionType.game` and that can be changed to
either `PositionType.viewport` or `PositionType.widget` depending on how you want to position
the component.

- `PositionType.game` (Default) - Respects camera and viewport.
- `PositionType.viewport` - Respects viewport only (ignores camera).
- `PositionType.widget` - Position in relation to the coordinate system of the Flutter game
widget (i.e. the raw canvas).

Most of your components will probably be positioned according to `PositionType.game`, since you
want them to respect the `Camera` and the `Viewport`. But quite often you want for example buttons
and text to always show on the screen, no matter if you move the camera, then you want to use
`PositionType.viewport`. In some rare cases you want to use `PositionType.widget` to position
your widgets, when you don't want the component to respect the camera nor the viewport; this could
for example be for controls or joysticks that would not be ergonomic to use if they had to stay
within the viewport.

Do note that this setting is only respected if the component is added directly to the root
`FlameGame` and not as a child component of another component.


### Visibility of components

The recommended way to hide or show a component is usually to add or remove it from the tree
Expand Down
15 changes: 0 additions & 15 deletions packages/flame/lib/src/components/core/position_type.dart

This file was deleted.

Loading