autolayout.wasm
v0.1.1
Published
fast AutoLayout & VFL for the Web. Written in C++, compiled to WASM using Emscripten.
Downloads
2
Readme
autolayout.wasm
This library is inspired by autolayout.js, but is several times faster.
install
npm i -S autolayout.wasm
basic usage
import 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:
- 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