diff --git a/layout/pages/zoning/zoning.xml b/layout/pages/zoning/zoning.xml
index 61a2cdc8..05db68e4 100644
--- a/layout/pages/zoning/zoning.xml
+++ b/layout/pages/zoning/zoning.xml
@@ -123,7 +123,7 @@
-
+
@@ -192,7 +192,8 @@
-
+
+
diff --git a/scripts/pages/zoning/zoning.ts b/scripts/pages/zoning/zoning.ts
index cc324e8a..e177adde 100644
--- a/scripts/pages/zoning/zoning.ts
+++ b/scripts/pages/zoning/zoning.ts
@@ -130,13 +130,13 @@ class ZoneMenu {
//@ts-expect-error function name not recognized
const entList = $.GetContextPanel().getEntityList();
- this.filternameList = entList.filter;
- this.teleDestList = entList.teleport;
- if (this.filternameList) {
+ this.filternameList = entList.filter ?? [];
+ this.teleDestList = entList.teleport ?? [];
+ if (this.filternameList !== null) {
this.filternameList.unshift($.Localize('#Zoning_Filter_None') as string);
this.populateDropdown(this.filternameList, this.panels.filterSelect, '', true);
}
- if (this.teleDestList) {
+ if (this.teleDestList !== null) {
this.teleDestList.unshift($.Localize('#Zoning_TPDest_MakeNew') as string);
this.teleDestList.unshift($.Localize('#Zoning_TPDest_None') as string);
this.populateDropdown(this.teleDestList, this.panels.regionTPDest, '', true);
@@ -379,8 +379,9 @@ class ZoneMenu {
this.panels.regionHeight.text = (region?.height ?? 0).toFixed(2) as string;
this.panels.regionSafeHeight.text = (region?.safeHeight ?? 0).toFixed(2) as string;
- const tpIndex = region.teleDestTargetName ? this.teleDestList?.indexOf(region.teleDestTargetName) ?? 0 : 0;
+ const tpIndex = region.teleDestTargetName === '' ? 0 : this.teleDestList?.indexOf(region.teleDestTargetName) as number;
this.panels.regionTPDest.SetSelectedIndex(tpIndex);
+ $.Msg('TP Index: ', tpIndex)
}
static addRegion() {
@@ -449,19 +450,33 @@ class ZoneMenu {
//delete region.teleDestPos;
//delete region.teleDestYaw;
// disable pos/yaw text entry
+ this.panels.regionTPPos.x.text = '';
+ this.panels.regionTPPos.y.text = '';
+ this.panels.regionTPPos.z.text = '';
+ this.panels.regionTPYaw.text = '';
this.panels.regionTPPos.x.enabled = false;
this.panels.regionTPPos.y.enabled = false;
this.panels.regionTPPos.z.enabled = false;
this.panels.regionTPYaw.enabled = false;
} else if (teleDestIndex === 1) {
- const position: Vec3D = { x: 0, y: 0, z: 0 };
- for (const [_, point] of region.points.entries()) {
- position.x += point.x;
- position.y += point.y;
+ if (!region.teleDestPos || !region.teleDestYaw) {
+ region.teleDestPos = { x: 0, y: 0, z: 0 };
+ for (const [_, point] of region.points.entries()) {
+ region.teleDestPos.x += point.x;
+ region.teleDestPos.y += point.y;
+ }
+ region.teleDestPos.x /= region.points.length;
+ region.teleDestPos.y /= region.points.length;
+ region.teleDestPos.z = region.bottom;
+ region.teleDestYaw = 0;
}
- position.x /= region.points.length;
- position.y /= region.points.length;
- position.z = region.bottom;
+
+
+ this.panels.regionTPPos.x.text = region.teleDestPos.x.toFixed(2);
+ this.panels.regionTPPos.y.text = region.teleDestPos.y.toFixed(2);
+ this.panels.regionTPPos.z.text = region.teleDestPos.z.toFixed(2);
+ this.panels.regionTPYaw.text = region.teleDestYaw.toFixed(2);
+
// enable pos/yaw text entry
this.panels.regionTPPos.x.enabled = true;
this.panels.regionTPPos.y.enabled = true;
@@ -472,6 +487,10 @@ class ZoneMenu {
//delete region.teleDestPos;
//delete region.teleDestYaw;
// disable pos/yaw text entry
+ this.panels.regionTPPos.x.text = '';
+ this.panels.regionTPPos.y.text = '';
+ this.panels.regionTPPos.z.text = '';
+ this.panels.regionTPYaw.text = '';
this.panels.regionTPPos.x.enabled = false;
this.panels.regionTPPos.y.enabled = false;
this.panels.regionTPPos.z.enabled = false;
diff --git a/styles/pages/zoning/zoning.scss b/styles/pages/zoning/zoning.scss
index 6ab6d8bf..6e2c399e 100644
--- a/styles/pages/zoning/zoning.scss
+++ b/styles/pages/zoning/zoning.scss
@@ -270,5 +270,11 @@ $medium: 28px;
horizontal-align: right;
margin-left: 16px;
width: 80px;
+
+ &:disabled,
+ &:disabled:hover {
+ background-color: $textentry-background;
+ color: $textentry-text-disabled;
+ }
}
}