new event propagator example

This commit is contained in:
“chrisshank” 2024-10-22 22:10:08 -07:00
parent 18e6051e2b
commit 11018f55ed
2 changed files with 63 additions and 1 deletions

View File

@ -0,0 +1,52 @@
{
"thoughts": [
{
"id": "1",
"text": "Blindfold chess requires internalizing chess structures.",
"x": 398,
"y": 166
},
{
"id": "2",
"text": "Internalizing chess structures builds intuition.",
"x": 73,
"y": 88
},
{
"id": "3",
"text": "Blindfold chess improves intuition.",
"x": 158,
"y": 337
},
{
"id": "4",
"text": "Building intuition is essential for chess improvement.",
"x": 457,
"y": 532
},
{
"id": "5",
"text": "Blindfold chess is useful for chess improvement.",
"x": 206,
"y": 621
}
],
"connections": [
{
"sourceId": "1",
"targetId": "3"
},
{
"sourceId": "2",
"targetId": "3"
},
{
"sourceId": "3",
"targetId": "5"
},
{
"sourceId": "4",
"targetId": "5"
}
]
}

View File

@ -16,7 +16,8 @@
} }
spatial-geometry { spatial-geometry {
background: rgb(187, 178, 178); border: 1px solid black;
border-radius: 3px;
} }
event-propagator { event-propagator {
@ -36,6 +37,15 @@
expression="$target.textContent += '!'" expression="$target.textContent += '!'"
></event-propagator> ></event-propagator>
<spatial-geometry id="box3" x="150" y="200" width="50" height="50"></spatial-geometry>
<spatial-geometry id="box4" x="300" y="350" width="50" height="50"></spatial-geometry>
<event-propagator
source="#box3"
target="#box4"
triggers="move"
expression="$target.y = $source.x"
></event-propagator>
<script type="module"> <script type="module">
import { SpatialGeometry } from '../src/canvas/spatial-geometry.ts'; import { SpatialGeometry } from '../src/canvas/spatial-geometry.ts';
import { EventPropagator } from '../src/arrows/event-propagator.ts'; import { EventPropagator } from '../src/arrows/event-propagator.ts';