-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #410 from open-source-labs/dev
feat: position prop features two way data binding
- Loading branch information
Showing
3 changed files
with
63 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<script lang="ts"> | ||
import { Svelvet, Node, Anchor } from '$lib'; | ||
let position = { x: 300, y: 300 }; | ||
$: console.log(position); | ||
</script> | ||
|
||
<body> | ||
<Svelvet minimap title="test"> | ||
<Node bgColor="red" inputs={4} bind:position> | ||
<div class="node-body"> | ||
<p>{JSON.stringify(position)}</p> | ||
<button | ||
on:click={() => { | ||
position = { x: 100, y: 100 }; | ||
}}>Move</button | ||
> | ||
</div> | ||
</Node> | ||
</Svelvet> | ||
</body> | ||
|
||
<style> | ||
.node-body { | ||
width: 200px; | ||
height: 300px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
body { | ||
width: 100vw; | ||
height: 100vh; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> |