diff --git a/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_dart_bridge.dart b/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_dart_bridge.dart index 120cdade..86413551 100644 --- a/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_dart_bridge.dart +++ b/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_dart_bridge.dart @@ -404,8 +404,16 @@ class ThermionViewerJSDartBridge { } @JSExport() - JSPromise setCameraFov(double degrees, double width, double height) => - viewer.setCameraFov(degrees, width, height).toJS; + JSPromise setParent( + ThermionEntity child, ThermionEntity parent, bool preserveScaling) { + return viewer + .setParent(child, parent, preserveScaling: preserveScaling) + .toJS; + } + + @JSExport() + JSPromise setCameraFov(double degrees, bool horizontal) => + viewer.setCameraFov(degrees, horizontal: horizontal).toJS; @JSExport() JSPromise setToneMapping(int mapper) => @@ -527,9 +535,11 @@ class ThermionViewerJSDartBridge { // b, // a, // ).toJS; + @JSExport() JSPromise transformToUnitCube(ThermionEntity entity) => viewer.transformToUnitCube(entity).toJS; + @JSExport() JSPromise setPosition(ThermionEntity entity, double x, double y, double z) => viewer.setPosition(entity, x, y, z).toJS; diff --git a/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_js.dart b/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_js.dart index 2872e312..02b454f7 100644 --- a/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_js.dart +++ b/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_js.dart @@ -5,6 +5,7 @@ import 'dart:typed_data'; import 'package:animation_tools_dart/animation_tools_dart.dart'; import 'package:logging/logging.dart'; +import 'package:thermion_dart/thermion_dart/entities/abstract_gizmo.dart'; import 'package:thermion_dart/thermion_dart/scene.dart'; import 'package:thermion_dart/thermion_dart/thermion_viewer.dart'; @@ -423,8 +424,8 @@ class ThermionViewerJS implements ThermionViewer { } @override - Future setCameraFov(double degrees, double width, double height) async { - await _shim.setCameraFov(degrees, width, height).toDart; + Future setCameraFov(double degrees, {bool horizontal = true}) async { + await _shim.setCameraFov(degrees, horizontal).toDart; } @override @@ -737,8 +738,9 @@ class ThermionViewerJS implements ThermionViewer { } @override - Future setParent(ThermionEntity child, ThermionEntity parent) async { - await _shim.setParent(child, parent).toDart; + Future setParent(ThermionEntity child, ThermionEntity parent, + {bool preserveScaling = false}) async { + await _shim.setParent(child, parent, preserveScaling).toDart; } @override @@ -857,4 +859,26 @@ class ThermionViewerJS implements ThermionViewer { final captured = await _shim.capture().toDart; return captured.toDart; } + + @override + late (double, double) viewportDimensions; + + @override + Future getBoundingBox(ThermionEntity entity) { + // return _shim.getBoundingBox(entity); + throw UnimplementedError(); + } + + @override + Future getCameraFov(bool horizontal) { + // TODO: implement getCameraFov + throw UnimplementedError(); + } + + @override + Future queueRelativePositionUpdateWorldAxis(ThermionEntity entity, + double viewportX, double viewportY, double x, double y, double z) { + // TODO: implement queueRelativePositionUpdateWorldAxis + throw UnimplementedError(); + } } diff --git a/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_js_shim.dart b/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_js_shim.dart index d4cf5dd2..5ade4d60 100644 --- a/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_js_shim.dart +++ b/thermion_dart/lib/thermion_dart/compatibility/web/interop/thermion_viewer_js_shim.dart @@ -220,7 +220,7 @@ extension type ThermionViewerJSShim(JSObject _) implements JSObject { external JSPromise getMainCamera(); @JS('setCameraFov') - external JSPromise setCameraFov(double degrees, double width, double height); + external JSPromise setCameraFov(double degrees, bool horizontal); @JS('setToneMapping') external JSPromise setToneMapping(int mapper); @@ -378,7 +378,7 @@ extension type ThermionViewerJSShim(JSObject _) implements JSObject { JSArray indices, String? materialPath, int primitiveType); @JS('setParent') - external JSPromise setParent(ThermionEntity child, ThermionEntity parent); + external JSPromise setParent(ThermionEntity child, ThermionEntity parent, bool preserveScaling); @JS('getParent') external JSPromise getParent(ThermionEntity child);