Render a file chooser as SVG
The example draws five file tiles in three columns. The final row has two items. Use the same geometry for touch or mouse hit testing when embedding the layout in a UI host.
Download the standalone example
Extract the archive and run weaver-demo.exe on Windows or ./weaver-demo on Linux and macOS. Each archive includes the Blyx source and tests.
Build from source
With Blyx 0.2.1, Rust and a host linker installed, run these commands to edit and rebuild the example.
git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-weaver.git cd blyx-weaver blyxc native-run project.blyx
Why this framework exists
A grid can draw a tile in one place and dispatch a click to its neighbor if painting and input code round dimensions differently. CSS Grid describes how tracks and gaps form a layout. Weaver uses one integer track calculation for both drawing and input. W3C, CSS Grid Layout Module Level 1
Install Weaver in your editor
Extension RahulChaube.blyx-weaver · 0.1.0
The extension includes a runnable Blyx example, function completions and the framework source. For the modular project, extract the starter, open its folder and run blyxc native-run main.blyx with the native toolchain installed.
Create an empty .blyx file, type blyx-weaver-demo and accept the completion. Choose Blyx: Run File to run the example.
For an offline installation, choose Extensions: Install from VSIX for Blyx Language first, then for Weaver.
Download the companion Blyx Language VSIXInstall with Conda
Create an environment containing Weaver 0.1.0, its Blyx source and a runnable example. Run the second command with Blyx 0.2.1, Rust and a host linker installed.
conda create -y --prefix ./blyx-env --override-channels -c https://rahulchaube1.github.io/blyx-packages blyx-weaver=0.1.0=0 blyxc native-run ./blyx-env/share/blyx/weaver/main.blyx
To use this package in your application, copy share/blyx/weaver/vendor/weaver from the environment into your project's vendor directory.
Import into a Blyx project
Install Blyx 0.2.1, Rust 1.85 or newer and a host linker. From the directory containing your entry file, clone this tagged release.
git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-weaver.git vendor/weaver
Save this as main.blyx beside vendor and run blyxc native-run main.blyx.
use vendor::weaver::weaver;
fn main() {
let columns = we_columns(320, 8, 8, 80, 6);
let second = we_rect(320, 8, 8, columns, 48, 1);
println!(columns);
println!(at(second, 0));
println!(we_hit(320, 8, 8, columns, 48, 5, 113, 19));
}Expected output
3 112 1
API and input requirements
Use integer logical pixels. Width, inset, gap, minimum width and row height support values up to 1,000,000. The column limit is 1–10,000, and a grid can address 1,000,000 items. Invalid geometry produces an empty rectangle or a missed hit. Right and bottom edges are exclusive. A narrow positive content area uses one column.
| API | Use |
|---|---|
we_columns(width, inset, gap, minimum, limit) | Choose a responsive column count; zero indicates an empty or invalid content area. |
we_rect(width, inset, gap, columns, rowHeight, index) | Return [x, y, width, height] in logical pixels. |
we_hit(width, inset, gap, columns, rowHeight, count, x, y) | Find the item under a pointer. Gutters, empty cells and outside positions return −1. |
Develop and contribute
Open the tagged source to read the implementation and examples. Include the smallest reproducible Blyx program, compiler version and expected result when reporting an issue.
