|
|
||
|---|---|---|
| .github/workflows | ||
| src | ||
| .gitignore | ||
| .yarnrc.yml | ||
| README.md | ||
| biome.json | ||
| index.html | ||
| package.json | ||
| tsconfig.json | ||
| vite.config.ts | ||
| yarn.lock | ||
README.md
scoped proagators
"Scoped propagators" are formed of a scope and a propagator which often looks like this:
click { text: "foo" }
The scope sets the events that cause propagation, such as clicks, ticks, or shape changes (not adding a scope will default to shape changes).
The propagator is a JS object (or function which returns one) that is applied to the shape.
Notes
- shapes are passed both
fromandtoshapes. - Shapes are flattened before being passed to the propagator, and unpacked on the other side. So properties live alongside the
x,y, androtationvalues (e.g.{ x: 100, y: 100, text: "foo" }).
Current Issues (probably should be fixed before putting out a demo):
- cycles of
changepropagators cause infinite recursion. geoscopes are currently fired for any shape change, this should be localised to spatially local changes.
Effects / Generic JS
You can create effects or run arbitrary JS code if you use the full function syntax:
click () { return { text: "foo" } }
This can be useful for larger propagators, or for doing arbitrary stuff with the editor.