Sanitize the window resizing scripts

Instead of magic numbers using a variable with comment so it's clear what is does.
This commit is contained in:
Nils Eikelenboom 2024-09-13 20:14:43 +02:00
parent ce8a10ba0a
commit 491f2e8bac
14 changed files with 42 additions and 28 deletions

View file

@ -31,8 +31,9 @@ function EVPathEditor::maxSize(%this, %window)
%fixedWindow = VPathEditorTreeWindow; %fixedWindow = VPathEditorTreeWindow;
%fluidWindow = VPathEditorOptionsWindow; %fluidWindow = VPathEditorOptionsWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -276,8 +276,9 @@ function ConvexEditorGui::maxSize(%this, %window)
%this.resizing = false; %this.resizing = false;
%fluidWindow = ConvexEditorOptionsWindow; %fluidWindow = ConvexEditorOptionsWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%position = Canvas.extent.x - %fluidWindow.extent.x SPC %top; %position = Canvas.extent.x - %fluidWindow.extent.x SPC %top;
%extent = %window.extent.x SPC Canvas.extent.y - %bottom; %extent = %window.extent.x SPC Canvas.extent.y - %bottom;

View file

@ -824,8 +824,9 @@ function DatablockEditorGui::maxSize(%this, %window)
%fixedWindow = DatablockEditorTreeWindow; %fixedWindow = DatablockEditorTreeWindow;
%fluidWindow = DatablockEditorInspectorWindow; %fluidWindow = DatablockEditorInspectorWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -54,8 +54,9 @@ function DecalEditorGui::maxSize(%this, %window)
%fixedWindow = DecalEditorWindow; %fixedWindow = DecalEditorWindow;
%fluidWindow = DecalPreviewWindow; %fluidWindow = DecalPreviewWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -56,8 +56,9 @@ function ForestEditorGui::maxSize(%this, %window)
%fixedWindow = ForestEditorPalleteWindow; %fixedWindow = ForestEditorPalleteWindow;
%fluidWindow = ForestEditorPropertiesWindow; %fluidWindow = ForestEditorPropertiesWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -284,8 +284,9 @@ function MaterialEditorGui::maxSize(%this, %window)
%fixedWindow = MaterialEditorPreviewWindow; %fixedWindow = MaterialEditorPreviewWindow;
%fluidWindow = MaterialEditorPropertiesWindow; %fluidWindow = MaterialEditorPropertiesWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -43,8 +43,9 @@ function MeshRoadEditorGui::maxSize(%this, %window)
%fixedWindow = MeshRoadEditorTreeWindow; %fixedWindow = MeshRoadEditorTreeWindow;
%fluidWindow = MeshRoadEditorOptionsWindow; %fluidWindow = MeshRoadEditorOptionsWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -54,8 +54,9 @@ function MissionAreaEditorGui::maxSize(%this, %window)
%fixedWindow = MissionAreaEditorTerrainWindow; %fixedWindow = MissionAreaEditorTerrainWindow;
%fluidWindow = MissionAreaEditorPropertiesWindow; %fluidWindow = MissionAreaEditorPropertiesWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -69,8 +69,9 @@ function NavEditorGui::maxSize(%this, %window)
%fixedWindow = NavEditorTreeWindow; %fixedWindow = NavEditorTreeWindow;
%fluidWindow = NavEditorOptionsWindow; %fluidWindow = NavEditorOptionsWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -276,8 +276,9 @@ function ParticleEditor::maxSize(%this, %window)
// prevent onResize after a resize // prevent onResize after a resize
%this.resizing = false; %this.resizing = false;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -60,8 +60,9 @@ function RiverEditorGui::maxSize(%this, %window)
%fixedWindow = RiverEditorTreeWindow; %fixedWindow = RiverEditorTreeWindow;
%fluidWindow = RiverEditorOptionsWindow; %fluidWindow = RiverEditorOptionsWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -73,8 +73,9 @@ function RoadEditorGui::maxSize(%this, %window)
%fixedWindow = RoadEditorTreeWindow; %fixedWindow = RoadEditorTreeWindow;
%fluidWindow = RoadEditorOptionsWindow; %fluidWindow = RoadEditorOptionsWindow;
%top = EditorGuiToolbar.extent.y + 6 - 7; %offset = -1; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -1616,8 +1616,9 @@ function EWorldEditor::maxSize(%this, %window)
%fixedWindow = EWTreeWindow; %fixedWindow = EWTreeWindow;
%fluidWindow = EWInspectorWindow; %fluidWindow = EWInspectorWindow;
%top = EditorGuiToolbar.extent.y + 6 + 19; %offset = 25; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom + 12; %maxHeight = Canvas.extent.y - %top - %bottom + 12;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------

View file

@ -596,8 +596,9 @@ function TerrainPainterContainer::maxSize(%this, %window)
%fixedWindow = EPainterPreview; %fixedWindow = EPainterPreview;
%fluidWindow = EPainter; %fluidWindow = EPainter;
%top = EditorGuiToolbar.extent.y + 6 - 7 + 24; %offset = 23; // tweak the vertical offset so that it aligns neatly
%bottom = %top + 65 - 6; %top = EditorGuiToolbar.extent.y + %offset;
%bottom = %top + 59;
%maxHeight = Canvas.extent.y - %top - %bottom; %maxHeight = Canvas.extent.y - %top - %bottom;
// --- Fixed window (top) ------------------------------------------------ // --- Fixed window (top) ------------------------------------------------