fix: shadow JS<->WASM bridge methods

This commit is contained in:
Nick Fisher
2024-07-04 16:29:08 +08:00
parent 7b97b2e6c3
commit d2fb40f317
3 changed files with 20 additions and 4 deletions

View File

@@ -720,4 +720,20 @@ class ThermionViewerJSDartBridge {
{JSFunction? callback, bool affectsTransform = false}) { {JSFunction? callback, bool affectsTransform = false}) {
throw UnimplementedError(); throw UnimplementedError();
} }
@JSExport()
JSPromise setShadowsEnabled(bool enabled) {
return viewer.setShadowsEnabled(enabled).toJS;
}
@JSExport()
JSPromise setShadowType(int shadowType) {
return viewer.setShadowType(ShadowType.values[shadowType]).toJS;
}
@JSExport()
JSPromise setSoftShadowOptions(
double penumbraScale, double penumbraRatioScale) {
return viewer.setSoftShadowOptions(penumbraScale, penumbraRatioScale).toJS;
}
} }

View File

@@ -829,7 +829,7 @@ class ThermionViewerJS implements ThermionViewer {
@override @override
Future setShadowType(ShadowType shadowType) { Future setShadowType(ShadowType shadowType) {
return _shim.setShadowType(shadowType).toDart; return _shim.setShadowType(shadowType.index).toDart;
} }
@override @override

View File

@@ -412,7 +412,7 @@ extension type ThermionViewerJSShim(JSObject _) implements JSObject {
@JS('setShadowType') @JS('setShadowType')
external JSPromise setShadowType( external JSPromise setShadowType(
ShadowType shadowType); int shadowType);
@JS('setSoftShadowOptions') @JS('setSoftShadowOptions')
external JSPromise setSoftShadowOptions( external JSPromise setSoftShadowOptions(