use locally scoped vars in js interop for easier debugging

This commit is contained in:
Nick Fisher
2024-05-19 14:18:05 +08:00
parent 4f9672cbbf
commit 467b80beb7

View File

@@ -201,9 +201,11 @@ class JsInteropFilamentViewer implements AbstractFilamentViewer {
@override @override
Future<void> setMorphTargetWeights( Future<void> setMorphTargetWeights(
FilamentEntity entity, List<double> weights) async { FilamentEntity entity, List<double> weights) async {
await _jsObject var jsWeights = weights.map((x) => x.toJS).cast<JSNumber>().toList().toJS;
.setMorphTargetWeights(entity, weights.map((x) => x.toJS).toList().toJS) var promise = _jsObject.setMorphTargetWeights(
.toDart; entity, jsWeights
);
await promise.toDart;
} }
@override @override
@@ -240,8 +242,8 @@ class JsInteropFilamentViewer implements AbstractFilamentViewer {
.toList() .toList()
.toJS; .toJS;
var morphTargetsJs = var morphTargetsJs =
animation.morphTargets.map((x) => x.toJS).toList().toJS; animation.morphTargets.map((x) => x.toJS).cast<JSString>().toList().toJS;
var targetMeshNamesJS = targetMeshNames?.map((x) => x.toJS).toList().toJS; var targetMeshNamesJS = targetMeshNames?.map((x) => x.toJS).cast<JSString>().toList().toJS;
await _jsObject await _jsObject
.setMorphAnimationData(entity, animationDataJs, morphTargetsJs, .setMorphAnimationData(entity, animationDataJs, morphTargetsJs,
targetMeshNamesJS, animation.frameLengthInMs) targetMeshNamesJS, animation.frameLengthInMs)