diff --git a/A320-main.xml b/A320-main.xml
index 649dd032..dac0ca36 100644
--- a/A320-main.xml
+++ b/A320-main.xml
@@ -160,9 +160,6 @@
Aircraft/IDG-A32X/Systems/pfd.xml
-
- Aircraft/IDG-A32X/Systems/zoom-views.xml
-
@@ -383,10 +380,6 @@
- 0.0
- 0.0
- false
-
80.0
30.0
300.0
@@ -1016,18 +1009,7 @@
nasal
@@ -1044,18 +1026,7 @@
nasal
@@ -1090,15 +1061,7 @@
Reset zoom to default
nasal
-
+
@@ -1344,21 +1307,8 @@
Increase field of view
true
- nasal
-
+ nasal
+
@@ -1367,20 +1317,7 @@
true
nasal
-
+
@@ -1509,6 +1446,7 @@
Aircraft/IDG-A32X/Nasal/ECAM.nas
Aircraft/IDG-A32X/Nasal/shake.nas
Aircraft/IDG-A32X/Nasal/light-manager.nas
+ Aircraft/IDG-A32X/Nasal/zoom-views.nas
Aircraft/IDG-A32X/AircraftConfig/acconfig.nas
diff --git a/Nasal/zoom-views.nas b/Nasal/zoom-views.nas
new file mode 100644
index 00000000..55df02b9
--- /dev/null
+++ b/Nasal/zoom-views.nas
@@ -0,0 +1,62 @@
+# IDG Distance Zooming
+# Copyright (c) 2018 Joshua Davidson (it0uchpods)
+# Based on PropertyRule file by onox
+
+var distance = 0;
+var min_dist = 0;
+var max_dist = 0;
+var canChangeZOffset = 0;
+var decStep = -5;
+var incStep = 5;
+var viewName = "XX";
+
+var fovZoom = func(d) {
+ viewName = getprop("/sim/current-view/name");
+ canChangeZOffset = getprop("/sim/current-view/type") == "lookat" and (viewName != "Tower View" or viewName != "Fly-By View" or viewName != "Chase View" or viewName != "Chase View Without Yaw" or viewName != "Walk View");
+
+ if (getprop("/sim/current-view/z-offset-m") <= -50) {
+ decStep = -10;
+ } else {
+ decStep = -5;
+ }
+
+ if (getprop("/sim/current-view/z-offset-m") < -50) { # Not a typo, the conditions are different
+ incStep = 10;
+ } else {
+ incStep = 5;
+ }
+
+ if (d == -1) {
+ if (canChangeZOffset) {
+ distance = getprop("/sim/current-view/z-offset-m");
+ min_dist = getprop("/sim/current-view/z-offset-min-m");
+
+ distance = math.round(std.min(-min_dist, distance + incStep) / incStep, 0.1) * incStep;
+ setprop("/sim/current-view/z-offset-m", distance);
+
+ gui.popupTip(sprintf("%d meters", abs(distance)));
+ } else {
+ view.decrease();
+ }
+ } else if (d == 1) {
+ if (canChangeZOffset) {
+ distance = getprop("/sim/current-view/z-offset-m");
+ max_dist = getprop("/sim/current-view/z-offset-max-m");
+
+ distance = math.round(std.max(-max_dist, distance + decStep) / decStep, 0.1) * decStep;
+ setprop("/sim/current-view/z-offset-m", distance);
+
+ gui.popupTip(sprintf("%d meters", abs(distance)));
+ } else {
+ view.increase();
+ }
+ } else if (d == 0) {
+ if (canChangeZOffset) {
+ setprop("/sim/current-view/z-offset-m", getprop("/sim/current-view/z-offset-default") * -1);
+ gui.popupTip(sprintf("%d meters", getprop("/sim/current-view/z-offset-default")));
+ } else {
+ setprop("/sim/current-view/field-of-view", getprop("/sim/view/config/default-field-of-view-deg"));
+ gui.popupTip(sprintf("FOV: %.1f", getprop("/sim/current-view/field-of-view")))
+ }
+ }
+}
diff --git a/Systems/zoom-views.xml b/Systems/zoom-views.xml
deleted file mode 100644
index d6457789..00000000
--- a/Systems/zoom-views.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
-
-
-
-
- View Zoom Enabled
-
-
-
- /sim/current-view/type
- lookat
-
-
- /sim/current-view/name
- Tower View
-
-
- /sim/current-view/name
- Fly-By View
-
-
- /sim/current-view/name
- Chase View
-
-
- /sim/current-view/name
- Chase View Without Yaw
-
-
- /sim/current-view/name
- Walk View
-
-
-
-
-
-
-
- View Zoom Decrease Step
- gain
-
-
-
- /sim/current-view/z-offset-m
- -50.0
-
-
- -10.0
-
-
- -5.0
-
-
-
-
-
- View Zoom Increase Step
- gain
-
-
-
- /sim/current-view/z-offset-m
- -50.0
-
-
- 10.0
-
-
- 5.0
-
-
-
-
-
diff --git a/revision.txt b/revision.txt
index b5d4cd6b..84e38ba4 100644
--- a/revision.txt
+++ b/revision.txt
@@ -1 +1 @@
-4667
\ No newline at end of file
+4668
\ No newline at end of file