This commit is contained in:
Nick Fisher
2024-10-23 01:20:22 +11:00
427 changed files with 74032 additions and 151261 deletions

View File

@@ -1,42 +0,0 @@
import 'package:thermion_dart/thermion_dart/compatibility/web/interop/thermion_viewer_wasm.dart';
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:thermion_flutter_platform_interface/thermion_flutter_platform_interface.dart';
import 'package:thermion_flutter_platform_interface/thermion_flutter_texture.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'package:web/web.dart';
class ThermionFlutterWebPlugin extends ThermionFlutterPlatform {
static void registerWith(Registrar registrar) {
ThermionFlutterPlatform.instance = ThermionFlutterWebPlugin();
}
@override
Future<ThermionFlutterTexture?> createTexture(
int width, int height, int offsetLeft, int offsetRight) async {
return ThermionFlutterTexture(null, null, 0, 0, null);
}
@override
Future destroyTexture(ThermionFlutterTexture texture) async {
// noop
}
@override
Future<ThermionFlutterTexture?> resizeTexture(ThermionFlutterTexture texture,
int width, int height, int offsetLeft, int offsetRight) async {
return ThermionFlutterTexture(null, null, 0, 0, null);
}
Future<ThermionViewer> createViewer({String? uberArchivePath}) async {
final canvas = document.getElementById("canvas") as HTMLCanvasElement;
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var width = window.innerWidth;
var height = window.innerHeight;
var viewer = ThermionViewerWasm(assetPathPrefix: "/assets/");
await viewer.initialize(width, height, uberArchivePath: uberArchivePath);
return viewer;
}
}

View File

@@ -0,0 +1,19 @@
import 'package:thermion_flutter_platform_interface/thermion_flutter_platform_interface.dart';
class ThermionFlutterWebOptions extends ThermionFlutterOptions {
final bool createCanvas;
final bool importCanvasAsWidget;
ThermionFlutterWebOptions(
{this.importCanvasAsWidget = false,
this.createCanvas = true,
String? uberarchivePath})
: super(uberarchivePath: uberarchivePath);
const ThermionFlutterWebOptions.empty(
{this.importCanvasAsWidget = false,
this.createCanvas = true,
String? uberarchivePath})
: super.empty();
}