Skip to content

Commit

Permalink
WIP control bar docs
Browse files Browse the repository at this point in the history
add function descriptions

remove note
  • Loading branch information
jenny-s51 committed Aug 25, 2023
1 parent aae31bd commit 8bfc3d4
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,64 @@ Pass the `TopologyControlBar` component to the `controlBar` prop, and pass the `
```ts file="./TopologyControlBarDemo.tsx"
```

## Action callback methods

### zoomInCallback

```noLive
/**
* Parameters:
* scale: The interview by which to scale up the topology view
* Returns:
* function that zooms in the topology view by the provided scale value.
* Scale changes are not saved on reload.
**/
zoomInCallback: action(() => {
controller.getGraph().scaleBy(4 / 3);
})
```

### zoomOutCallback

```noLive
/**
* Parameters:
* scale: The interview by which to scale down the topology view
* Returns:
* function that zooms out the topology view by the provided scale value.
* Scale changes are not saved on reload.
**/
zoomOutCallback: action(() => {
controller.getGraph().scaleBy(0.75);
}),
```

### fitToScreenCallback

```noLive
/**
* Parameters:
* padding: The padding to give the topology view such that it fits the screen and shows all the nodes
* Returns:
* function that fits the topology view to the screen. Scale changes are not saved on reload.
* Fit to screen will not scale up higher than the current scale or 1, whichever is greater.
* Therefore it does not zoom in.
**/
fitToScreenCallback: action(() => {
controller.getGraph().fit(80);
}),
```

### resetViewCallback

```noLive
/**
* Returns:
* function that resets the topology view to its initial placement on load.
**/
resetViewCallback: action(() => {
controller.getGraph().reset();
controller.getGraph().layout();
}),
```
2 changes: 1 addition & 1 deletion packages/module/patternfly-docs/generated/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
'/topology/control-bar/extensions': {
id: "Control Bar",
title: "Control Bar",
toc: [[{"text":"Topology with a control bar"}]],
toc: [[{"text":"Topology with a control bar"}],{"text":"Action callback methods"},[{"text":"zoomInCallback"},{"text":"zoomOutCallback"},{"text":"fitToScreenCallback"},{"text":"resetViewCallback"}]],
examples: ["Topology with a control bar"],
section: "topology",
subsection: "",
Expand Down

0 comments on commit 8bfc3d4

Please sign in to comment.