From 7b08fd5498a20ebb093c6778c73fa5ac1832617c Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Thu, 28 Mar 2024 14:29:24 +0100
Subject: [PATCH] compute width and height

---
 components/content/MolstarPdbePlugin.vue |  7 +------
 components/content/PdbeMolstarPlugin.vue | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/components/content/MolstarPdbePlugin.vue b/components/content/MolstarPdbePlugin.vue
index 114d01c6..dc645704 100644
--- a/components/content/MolstarPdbePlugin.vue
+++ b/components/content/MolstarPdbePlugin.vue
@@ -2,10 +2,6 @@
 
 import { withTrailingSlash, withLeadingSlash, joinURL } from 'ufo'
 import { useRuntimeConfig, computed } from '#imports'
-import * as d3 from "d3";
-import * as Plot from "@observablehq/plot";
-import PlotFigure from "~/components/PlotFigure";
-
 import { useDisplay } from "vuetify";
 
 export interface Props {
@@ -18,7 +14,7 @@ export interface Props {
 
 
 
-const { mobile } = useDisplay()
+const { mobile, width, height  } = useDisplay()
 const refinedDataUrls = computed(() => {
 
     function refinedUrl(url: string) {
@@ -59,7 +55,6 @@ const props = withDefaults(defineProps<Props>(), {
     dataUrl: undefined
 })
 
-const { width, height } = useDisplay()
 
 const maxWidth = ref(1500)
 
diff --git a/components/content/PdbeMolstarPlugin.vue b/components/content/PdbeMolstarPlugin.vue
index bb1a3cee..5fd1b3fa 100644
--- a/components/content/PdbeMolstarPlugin.vue
+++ b/components/content/PdbeMolstarPlugin.vue
@@ -1,9 +1,14 @@
 <script setup lang="ts">
 import { withTrailingSlash, withLeadingSlash, joinURL } from 'ufo'
 import { useRuntimeConfig, computed, toValue } from '#imports'
+import { useDisplay } from "vuetify";
+
 import type { MaybeRef } from "vue"
 import FoldseekDialog from '../FoldseekDialog.vue'
 
+const { mobile, width, height } = useDisplay()
+
+
 useHead({
     link: [
         {
@@ -48,6 +53,15 @@ const selectedPdb: Ref<string | null> = ref(null)
 const structureToDownload: Ref<string | null> = ref(null)
 
 
+const computedWidth = computed(() => {
+    // if (toValue(width) > toValue(maxWidth)) return toValue(maxWidth) / 1.5
+    return toValue(width) / 1.5
+})
+
+const computedHeight = computed(() => {
+    return height.value - 250
+})
+
 function refinedUrl(url: string) {
     if (url?.startsWith('/') && !url.startsWith('//')) {
         const _base = withLeadingSlash(withTrailingSlash(useRuntimeConfig().app.baseURL))
-- 
GitLab