From 94c937d90714c1d0e362f6442045812bdefd9a1f Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 3 Jan 2017 16:32:21 +0000
Subject: [PATCH] follow initial scale/translate/rotate options

---
 contrib/mobile/drawContext.cpp | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/contrib/mobile/drawContext.cpp b/contrib/mobile/drawContext.cpp
index f84ba5562d..ec9917f0b6 100644
--- a/contrib/mobile/drawContext.cpp
+++ b/contrib/mobile/drawContext.cpp
@@ -70,12 +70,12 @@ void drawContext::load(std::string filename)
   // open the file with Gmsh
   GmshOpenProject(filename);
 
-  // reset openGL view
-  eventHandler(10);
-
   // run onelab clients to populate the database
   onelab_cb("check");
 
+  // set openGL view using CTX options
+  eventHandler(8);
+
   // mark all parameters as changed to force complete first run
   onelab::server::instance()->setChanged(3);
 }
@@ -133,6 +133,16 @@ void drawContext::eventHandler(int event, float x, float y)
   case 7: // Z view
     setQuaternion(0., 0., 0., 1.);
     break;
+  case 8: // CTX options
+    for(int i = 0; i < 3; i++){
+      _translate[i] = CTX::instance()->tmpTranslation[i];
+      _scale[i] = CTX::instance()->tmpScale[i];
+    }
+    setQuaternion(CTX::instance()->tmpQuaternion[0],
+                  CTX::instance()->tmpQuaternion[1],
+                  CTX::instance()->tmpQuaternion[2],
+                  CTX::instance()->tmpQuaternion[3]);
+    break;
   default: // all other reset the position
     setQuaternion(0., 0., 0., 1.);
     for(int i = 0; i < 3; i++){
-- 
GitLab