feat(svelte): add fitViewOptions for Controls closes #4201
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
type Node,
|
||||
type Edge,
|
||||
ConnectionMode,
|
||||
useSvelteFlow,
|
||||
ControlButton
|
||||
ControlButton,
|
||||
type FitViewOptions
|
||||
} from '@xyflow/svelte';
|
||||
|
||||
import CustomNode from './CustomNode.svelte';
|
||||
@@ -33,6 +33,11 @@
|
||||
custom: CustomEdge
|
||||
};
|
||||
|
||||
const fitViewOptions: FitViewOptions = {
|
||||
padding: 0.2,
|
||||
nodes: [{ id: '1' }, { id: '2' }]
|
||||
};
|
||||
|
||||
const nodes = writable<Node[]>([
|
||||
{
|
||||
id: '1',
|
||||
@@ -191,7 +196,7 @@
|
||||
attributionPosition={'top-center'}
|
||||
deleteKey={['Backspace', 'd']}
|
||||
>
|
||||
<Controls orientation="horizontal">
|
||||
<Controls orientation="horizontal" {fitViewOptions}>
|
||||
<ControlButton slot="before">xy</ControlButton>
|
||||
<ControlButton aria-label="log" on:click={() => console.log('control button')}
|
||||
>log</ControlButton
|
||||
|
||||
Reference in New Issue
Block a user