diff --git a/playground/src/jsMain/kotlin/PlayGroundApp.kt b/playground/src/jsMain/kotlin/PlayGroundApp.kt deleted file mode 100644 index 4a3018a0..00000000 --- a/playground/src/jsMain/kotlin/PlayGroundApp.kt +++ /dev/null @@ -1,67 +0,0 @@ -import hep.dataforge.context.Context -import hep.dataforge.context.Global -import hep.dataforge.meta.DFExperimental -import hep.dataforge.vision.client.VisionClient -import hep.dataforge.vision.client.renderAllVisions -import hep.dataforge.vision.plotly.PlotlyPlugin -import hep.dataforge.vision.solid.three.ThreePlugin -import kotlinx.browser.window - -//fun RBuilder.threeCanvas(object3D: Solid, options: Canvas3DOptions.() -> Unit = {}) { -// child(ThreeCanvasComponent) { -// attrs { -// this.obj = object3D -// this.options = Canvas3DOptions(options) -// } -// } -//} -// -//private class PlayGroundApp : Application { -// -// override fun start(state: Map) { -// -// val element = -// document.getElementById("app") as? HTMLElement ?: error("Element with id 'canvas' not found on page") -// -// val obj = SolidGroup().apply { -// box(100, 100, 100, name = "A") -// group("B") { -// position = Point3D(120, 0, 0) -// box(100, 100, 100, name = "C") -// } -// } -// -// render(element) { -// div("row") { -// div("col-3") { -// objectTree(obj) -// } -// div("col-6") { -// threeCanvas(obj) -// } -// div("col-3") { -// visionPropertyEditor(obj) -// } -// } -// } -// } -// -//} - -public val visionContext: Context = Global.context("VISION") { - plugin(ThreePlugin) - plugin(PlotlyPlugin) - plugin(VisionClient) -} - -@DFExperimental -fun main() { - //Loading three-js renderer - val clientManager = visionContext.plugins.fetch(VisionClient) - - //Fetch from server and render visions for all outputs - window.onload = { - clientManager.renderAllVisions() - } - //startApplication(::PlayGroundApp) -} \ No newline at end of file diff --git a/playground/src/jsMain/kotlin/playgroundMain.kt b/playground/src/jsMain/kotlin/playgroundMain.kt new file mode 100644 index 00000000..6c577e6f --- /dev/null +++ b/playground/src/jsMain/kotlin/playgroundMain.kt @@ -0,0 +1,27 @@ +import hep.dataforge.context.Context +import hep.dataforge.context.Global +import hep.dataforge.meta.DFExperimental +import hep.dataforge.vision.client.VisionClient +import hep.dataforge.vision.client.renderAllVisions +import hep.dataforge.vision.plotly.PlotlyPlugin +import hep.dataforge.vision.solid.three.ThreePlugin +import kotlinx.browser.window + +@DFExperimental +fun main() { + + val visionContext: Context = Global.context("VISION") { + plugin(ThreePlugin) + plugin(PlotlyPlugin) + plugin(VisionClient) + } + + //Loading three-js renderer + val clientManager = visionContext.plugins.fetch(VisionClient) + + //Fetch from server and render visions for all outputs + window.onload = { + clientManager.renderAllVisions() + } + //startApplication(::PlayGroundApp) +} \ No newline at end of file diff --git a/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/randomSpheres.kt b/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/randomSpheres.kt index 728714af..90031fd3 100644 --- a/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/randomSpheres.kt +++ b/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/randomSpheres.kt @@ -32,7 +32,7 @@ fun main() { } } - visionContext.makeVisionFile( + VisionForge.makeVisionFile( fragment, Paths.get("randomSpheres.html"), resourceLocation = ResourceLocation.EMBED diff --git a/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/serverExtensions.kt b/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/serverExtensions.kt index c1f3b273..2e365104 100644 --- a/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/serverExtensions.kt +++ b/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/serverExtensions.kt @@ -17,7 +17,7 @@ import java.nio.file.Path * A global vision context used to resolve different vision renderers */ @DFExperimental -public val visionContext: Context = Global.context("VISION") { +public val VisionForge: Context = Global.context("VISION") { plugin(VisionManager) plugin(SolidManager) } diff --git a/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/simpleCube.kt b/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/simpleCube.kt index ca8e70b5..c1d20ef7 100644 --- a/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/simpleCube.kt +++ b/playground/src/jvmMain/kotlin/hep/dataforge/vision/solid/simpleCube.kt @@ -15,5 +15,5 @@ fun main() { } } - visionContext.makeVisionFile(fragment = fragment, resourceLocation = ResourceLocation.SYSTEM) + VisionForge.makeVisionFile(fragment = fragment, resourceLocation = ResourceLocation.SYSTEM) } \ No newline at end of file