diff --git a/.dockerignore b/.dockerignore index ca154cd..bd5793c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,4 +6,4 @@ !nextcloud_mcp_server/**/*.py !nextcloud_mcp_server/**/*.html -!nextcloud_mcp_server/auth/static/*.png +!nextcloud_mcp_server/auth/static/* diff --git a/nextcloud_mcp_server/auth/static/vector-viz.js b/nextcloud_mcp_server/auth/static/vector-viz.js index cd9f557..bf98a20 100644 --- a/nextcloud_mcp_server/auth/static/vector-viz.js +++ b/nextcloud_mcp_server/auth/static/vector-viz.js @@ -120,15 +120,22 @@ function vizApp() { } }; + // Preserve camera position if plot already exists + const plotDiv = document.getElementById('viz-plot'); + let cameraSettings = { eye: { x: 1.5, y: 1.5, z: 1.5 } }; // Default camera position + + if (plotDiv && plotDiv.layout && plotDiv.layout.scene && plotDiv.layout.scene.camera) { + // Plot exists and has been interacted with - preserve current camera + cameraSettings = plotDiv.layout.scene.camera; + } + const layout = { title: `Vector Space (PCA 3D) - ${results.length} results`, scene: { xaxis: { title: 'PC1' }, yaxis: { title: 'PC2' }, zaxis: { title: 'PC3' }, - camera: { - eye: { x: 1.5, y: 1.5, z: 1.5 } - } + camera: cameraSettings }, hovermode: 'closest', autosize: true, // Enable auto-sizing to fit container @@ -145,7 +152,9 @@ function vizApp() { displayModeBar: true }; - Plotly.newPlot('viz-plot', traces, layout, config); + // Use Plotly.react() instead of newPlot() to preserve camera position + // when toggling query point visibility + Plotly.react('viz-plot', traces, layout, config); }, getNextcloudUrl(result) { diff --git a/nextcloud_mcp_server/auth/templates/user_info.html b/nextcloud_mcp_server/auth/templates/user_info.html index 227114f..25f527b 100644 --- a/nextcloud_mcp_server/auth/templates/user_info.html +++ b/nextcloud_mcp_server/auth/templates/user_info.html @@ -11,6 +11,9 @@ + + + {% endblock %} {% block extra_styles %} diff --git a/nextcloud_mcp_server/auth/templates/vector_viz.html b/nextcloud_mcp_server/auth/templates/vector_viz.html index b68fe19..a052d9e 100644 --- a/nextcloud_mcp_server/auth/templates/vector_viz.html +++ b/nextcloud_mcp_server/auth/templates/vector_viz.html @@ -1,5 +1,3 @@ - -