From 1a8a902f85563262cb7f86dd44b25d072bc795bd Mon Sep 17 00:00:00 2001
From: Valentin Perrelle <valentin.perrelle@cea.fr>
Date: Thu, 6 Oct 2022 23:35:54 +0200
Subject: [PATCH] [Ivette] Dive: set minimal and maximal zoom levels

---
 ivette/src/frama-c/plugins/dive/index.tsx | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ivette/src/frama-c/plugins/dive/index.tsx b/ivette/src/frama-c/plugins/dive/index.tsx
index 0f89148e3e6..2947b0ab3a8 100644
--- a/ivette/src/frama-c/plugins/dive/index.tsx
+++ b/ivette/src/frama-c/plugins/dive/index.tsx
@@ -124,6 +124,9 @@ class Dive {
     this.headless = this.cy.container() === null;
     this.cy.elements().remove();
 
+    this.cy.minZoom(1e-1);
+    this.cy.maxZoom(1.0);
+
     // Remove previous listeners
     this.cy.off('click');
     this.cy.off('double-click');
@@ -133,7 +136,11 @@ class Dive {
     this.cy.on('click', 'node', (event) => this.clickNode(event.target));
     this.cy.on('double-click', '$node > node', // compound nodes
       (event) => this.doubleClickNode(event.target));
-    (this.cy as CytoscapeExtended).panzoom({});
+    const panzoomDefaults = {
+      minZoom: this.cy.minZoom(),
+      maxZoom: this.cy.maxZoom(),
+    };
+    (this.cy as CytoscapeExtended).panzoom(panzoomDefaults);
 
     this.layout = 'cose-bilkent';
 
-- 
GitLab