Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yingdev/autolayout.wasm
fast AutoLayout & VFL for the Web. Written in C++, compiled to WASM using Emscripten.
https://github.com/yingdev/autolayout.wasm
Last synced: about 2 months ago
JSON representation
fast AutoLayout & VFL for the Web. Written in C++, compiled to WASM using Emscripten.
- Host: GitHub
- URL: https://github.com/yingdev/autolayout.wasm
- Owner: yingDev
- Created: 2019-04-20T09:03:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-21T17:02:47.000Z (over 5 years ago)
- Last Synced: 2024-10-13T01:05:06.374Z (3 months ago)
- Language: C++
- Homepage:
- Size: 90.8 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/v/autolayout.wasm.svg?style=flat-square)](https://www.npmjs.com/package/autolayout.wasm)
# autolayout.wasm
This library is inspired by [autolayout.js](https://github.com/IjzerenHein/autolayout.js), but is several times faster.# install
```bash
npm i -S autolayout.wasm
```# basic usage
```typescriptimport AutoLayout from "autolayout.wasm";
//we need to wait the .wasm file loaded
AutoLayout.ready.then(()=>
{
let view = new AutoLayout.View();
let cons = AutoLayout.parse_evfl(`
H:|-[a(123)]-[b(456)]-| |~[c)]~|;
V:|[a][b]|;
C:d.w(50%).h(100).cx(0).cy(0)`
);
view.raw_addConstraints(cons, false);
view.update();
let subViews = {};
view.getSubViews(subViews);
for(let name in subViews)
{
let sv = subViews[name];
console.log(`${name}: ${sv.left()}, ${sv.top()}, ${sv.width()}, ${sv.height()}`);
}
});
```# build
- make sure these are installed:
- [cmake](https://cmake.org/download/)
- [emsdk](https://github.com/emscripten-core/emsdk)
- [boost](https://www.boost.org/users/download/)
- set these environment variables:
- `EMSCRIPTEN_CMAKE_TOOLCHAIN_FILE` (eg. `/Developer/emsdk/emscripten/1.38.30/cmake/Modules/Platform/Emscripten.cmake`)
- `BOOST_ROOT` (eg. `/usr/local/Cellar/boost/1.69.0`)
- run `npm test`# todo: documentation