mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
wasm: Support viewport API
wasm binding for viewport API in web. see: #2276
This commit is contained in:
parent
b19ae5b8c0
commit
6870953713
1 changed files with 12 additions and 0 deletions
|
@ -165,6 +165,17 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool viewport(float x, float y, float width, float height)
|
||||
{
|
||||
if (!canvas || !animation) return false;
|
||||
if (canvas->viewport(x, y, width, height) != Result::Success) {
|
||||
errorMsg = "viewport() fail";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void resize(int width, int height)
|
||||
{
|
||||
if (!canvas || !animation) return;
|
||||
|
@ -339,6 +350,7 @@ EMSCRIPTEN_BINDINGS(thorvg_bindings)
|
|||
.function("load", &TvgLottieAnimation ::load)
|
||||
.function("update", &TvgLottieAnimation ::update)
|
||||
.function("frame", &TvgLottieAnimation ::frame)
|
||||
.function("viewport", &TvgLottieAnimation ::viewport)
|
||||
.function("resize", &TvgLottieAnimation ::resize)
|
||||
.function("save", &TvgLottieAnimation ::save);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue