From 30e637020423eed521fb129786635782868dc1ce Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 1 Mar 2021 21:33:25 +0300 Subject: [PATCH] Fix all gdml --- .../VisionForgePlayGroundForJupyter.kt | 4 +-- .../src/jsMain/kotlin/playgroundMain.kt | 5 +++ .../hep/dataforge/vision/visionForgeJs.kt | 31 ++++++++++--------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/demo/jupyter-playground/src/main/kotlin/hep/dataforge/playground/VisionForgePlayGroundForJupyter.kt b/demo/jupyter-playground/src/main/kotlin/hep/dataforge/playground/VisionForgePlayGroundForJupyter.kt index b24a1eb2..f9b33877 100644 --- a/demo/jupyter-playground/src/main/kotlin/hep/dataforge/playground/VisionForgePlayGroundForJupyter.kt +++ b/demo/jupyter-playground/src/main/kotlin/hep/dataforge/playground/VisionForgePlayGroundForJupyter.kt @@ -43,7 +43,7 @@ internal class VisionForgePlayGroundForJupyter : JupyterIntegration() { } script { type = "text/javascript" - unsafe { +"renderVisionsAt(\"$id\");" } + unsafe { +"window.renderVisionsAt(\"$id\");" } } } @@ -63,7 +63,7 @@ internal class VisionForgePlayGroundForJupyter : JupyterIntegration() { "hep.dataforge.vision.solid.*" ) - import("hep.dataforge.vision.VisionForge") + import() render { gdmlModel -> val fragment = VisionForge.fragment { diff --git a/demo/playground/src/jsMain/kotlin/playgroundMain.kt b/demo/playground/src/jsMain/kotlin/playgroundMain.kt index 6c3bb939..6f397312 100644 --- a/demo/playground/src/jsMain/kotlin/playgroundMain.kt +++ b/demo/playground/src/jsMain/kotlin/playgroundMain.kt @@ -1,9 +1,14 @@ +import hep.dataforge.misc.DFExperimental import hep.dataforge.vision.VisionForge import hep.dataforge.vision.plotly.usePlotly import hep.dataforge.vision.solid.three.useThreeJs +import kotlinx.browser.window +@DFExperimental fun main(): Unit = VisionForge.run{ usePlotly() useThreeJs() renderVisionsInWindow() + window.asDynamic()["renderVisionsAt"] = ::renderVisionsAt + window.asDynamic()["renderVisionsInWindow"] = ::renderVisionsInWindow } \ No newline at end of file diff --git a/visionforge-core/src/jsMain/kotlin/hep/dataforge/vision/visionForgeJs.kt b/visionforge-core/src/jsMain/kotlin/hep/dataforge/vision/visionForgeJs.kt index 32eb9a62..a1f40a4d 100644 --- a/visionforge-core/src/jsMain/kotlin/hep/dataforge/vision/visionForgeJs.kt +++ b/visionforge-core/src/jsMain/kotlin/hep/dataforge/vision/visionForgeJs.kt @@ -43,17 +43,20 @@ public val VisionForge.visionClient: VisionClient get() = plugins.fetch(VisionClient) - -/** - * Render all visions in this [window] using current global state of [VisionForge] - */ -@DFExperimental -@JsExport -public fun renderVisionsInWindow(): Unit = VisionForge.renderVisionsInWindow() - -/** - * Render all visions in an element with a given [id] - */ -@DFExperimental -@JsExport -public fun renderVisionsAt(id: String): Unit = VisionForge.renderVisionsAt(id) \ No newline at end of file +///** +// * Render all visions in this [window] using current global state of [VisionForge] +// */ +//@DFExperimental +//@JsExport +//public fun renderVisionsInWindow(): Unit { +// VisionForge.renderVisionsInWindow() +//} +// +///** +// * Render all visions in an element with a given [id] +// */ +//@DFExperimental +//@JsExport +//public fun renderVisionsAt(id: String): Unit { +// VisionForge.renderVisionsAt(id) +//} \ No newline at end of file