From d34fdc65c46b9f6107e645661924443989808428 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Mischler=20=28aka=20skarab=29?=
 <skarab@bluewin.ch>
Date: Sat, 6 Aug 2016 10:12:38 +0200
Subject: [PATCH] Moved mirror settings from slicer panel to transformation
 panel

---
 index.html | 12 ++++++------
 js/main.js | 28 ++++++++++++++--------------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/index.html b/index.html
index 5062ef7..4670855 100644
--- a/index.html
+++ b/index.html
@@ -57,6 +57,12 @@
                         <h3 class="panel-title">Transformations</h3>
                     </div>
                     <div id="transform-body" class="panel-body collapse in">
+                        <div class="form-group">
+                            <label for="transform-mirror">Mirror</label>
+                            <input type="radio" name="transform-mirror" id="transform-mirror-yes" value="yes" /> yes
+                            <input type="radio" name="transform-mirror" id="transform-mirror-no" value="no" checked="checked" /> no
+                        </div>
+                        <hr />
                         <div class="form-group">
                             <label for="transform-action">Action</label>
                             <select id="transform-action" class="form-control input-sm">
@@ -179,12 +185,6 @@ <h3 class="panel-title">Slicer</h3>
 
                         <hr />
 
-                        <div class="form-group">
-                            <label for="slicer-mirror">Mirror output</label>
-                            <input type="radio" name="slicer-mirror" id="slicer-mirror-yes" value="yes" /> yes
-                            <input type="radio" name="slicer-mirror" id="slicer-mirror-no" value="no" checked="checked" /> no
-                        </div>
-
                         <div class="form-group">
                             <label for="slicer-image-extension">Output type</label>
                             <input type="radio" name="slicer-image-extension" id="slicer-image-extension-png" value="png" checked="checked" /> png
diff --git a/js/main.js b/js/main.js
index d978635..1a4ec46 100644
--- a/js/main.js
+++ b/js/main.js
@@ -468,9 +468,6 @@ var $slicerLightOn     = $slicerBody.find('#slicer-light-on');
 var $slicerLiftingSpeed  = $slicerBody.find('#slicer-lifting-speed');
 var $slicerLiftingHeight = $slicerBody.find('#slicer-lifting-height');
 
-var $slicerMirrorYes = $slicerBody.find('#slicer-mirror-yes');
-var $slicerMirrorNo  = $slicerBody.find('#slicer-mirror-no');
-
 var $slicerExportPNG = $slicerBody.find('#slicer-image-extension-png');
 var $slicerExportSVG = $slicerBody.find('#slicer-image-extension-svg');
 
@@ -503,8 +500,6 @@ function updateSlicerSettings() {
     settings.set('slicer.lifting.speed', $slicerLiftingSpeed.val());
     settings.set('slicer.lifting.height', $slicerLiftingHeight.val());
 
-    settings.set('slicer.mirror', $slicerMirrorYes[0].checked);
-
     settings.set('slicer.png', $slicerExportPNG[0].checked);
     settings.set('slicer.svg', $slicerExportSVG[0].checked);
 
@@ -517,14 +512,6 @@ function updateSlicerSettings() {
     updateSliderUI();
 }
 
-function flipGeometry() {
-    loadGeometry(slicer.mesh.geometry, true);
-    getSlice($sliderInput.slider('getValue'));
-}
-
-$slicerMirrorYes.on('change', flipGeometry);
-$slicerMirrorNo.on('change', flipGeometry);
-
 var sliceInterval;
 var expectedSliceInterval;
 var currentSliceNumber;
@@ -644,7 +631,6 @@ $abortButton.on('click', function(e) {
 });
 
 $('#slicer-image-extension-' + (settings.get('slicer.png') ? 'png' : 'svg')).prop('checked', true);
-$('#slicer-mirror-' + (settings.get('slicer.mirror') ? 'yes' : 'no')).prop('checked', true);
 $('#slicer-make-zip-' + (settings.get('slicer.zip') ? 'yes' : 'no')).prop('checked', true);
 $('#slicer-speed-' + (settings.get('slicer.speed') ? 'yes' : 'no')).prop('checked', true);
 $('#slicer input').on('input, change', updateSlicerSettings);
@@ -828,6 +814,9 @@ var $transformY       = $transformBody.find('#transform-y');
 var $transformZ       = $transformBody.find('#transform-z');
 var $transformButtons = $transformBody.find('button');
 
+var $transformMirrorYes = $transformBody.find('#transform-mirror-yes');
+var $transformMirrorNo  = $transformBody.find('#transform-mirror-no');
+
 var transformAction, transformations;
 
 function resetTransformValues() {
@@ -978,6 +967,17 @@ $transformButtons.on('click', function(e) {
     updateTransformValues();
 });
 
+function flipGeometry() {
+    console.log('plop');
+    settings.set('slicer.mirror', $transformMirrorYes[0].checked);
+    loadGeometry(slicer.mesh.geometry, true);
+    getSlice($sliderInput.slider('getValue'));
+}
+
+$transformMirrorYes.on('change', flipGeometry);
+$transformMirrorNo.on('change', flipGeometry);
+
+$('#slicer-mirror-' + (settings.get('slicer.mirror') ? 'yes' : 'no')).prop('checked', true);
 $('#transform select').on('change', updateTransformAction);
 $('#transform input').on('change', updateTransformValues);
 resetTransformValues();
