From 5e6d3fde31adca13ebcc102adc564ce5c90688ae Mon Sep 17 00:00:00 2001
From: Hooye!! <110253374+Davvv1@users.noreply.github.com>
Date: Mon, 23 Mar 2026 18:56:36 +0000
Subject: [PATCH 1/7] added options 'keep-height' and 'keep-width' to stage
size options
---
scaffolding-api-docs/README.md | 2 +-
src/p4/PackagerOptions.svelte | 10 ++++++++++
src/scaffolding/scaffolding.js | 20 ++++++++++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/scaffolding-api-docs/README.md b/scaffolding-api-docs/README.md
index b25b81cd..e4ba27f1 100644
--- a/scaffolding-api-docs/README.md
+++ b/scaffolding-api-docs/README.md
@@ -111,7 +111,7 @@ Certain Scaffolding options must be configured before you can finish setting up
```js
scaffolding.width = 480; // Custom stage width
scaffolding.height = 360; // Custom stage height
-scaffolding.resizeMode = 'preserve-ratio'; // or 'dynamic-resize' or 'stretch'
+scaffolding.resizeMode = 'preserve-ratio'; // or 'dynamic-resize' or 'stretch' or 'keep-height' or 'keep-width'
scaffolding.editableLists = false; // Affects list monitors
```
diff --git a/src/p4/PackagerOptions.svelte b/src/p4/PackagerOptions.svelte
index 5975e2ea..48ef83a5 100644
--- a/src/p4/PackagerOptions.svelte
+++ b/src/p4/PackagerOptions.svelte
@@ -440,6 +440,16 @@
{$_('options.dynamicResize')}
+
+
diff --git a/src/scaffolding/scaffolding.js b/src/scaffolding/scaffolding.js
index 964c14bc..e7f33743 100644
--- a/src/scaffolding/scaffolding.js
+++ b/src/scaffolding/scaffolding.js
@@ -283,6 +283,26 @@ class Scaffolding extends EventTarget {
let width = projectAreaWidth;
let height = projectAreaHeight;
+ if (this.resizeMode === 'keep-height') {
+ // setStageSize is a TurboWarp-specific method
+ if (this.vm.setStageSize) {
+ this.width = width / height * this.height;
+ this.vm.setStageSize(this.width, this.height);
+ } else {
+ console.warn('keep-height not supported: vm does not implement setStageSize');
+ }
+ }
+
+ if (this.resizeMode === 'keep-width') {
+ // setStageSize is a TurboWarp-specific method
+ if (this.vm.setStageSize) {
+ this.height = height / width * this.width;
+ this.vm.setStageSize(this.width, this.height);
+ } else {
+ console.warn('keep-width not supported: vm does not implement setStageSize');
+ }
+ }
+
if (this.resizeMode !== 'stretch') {
width = height / this.height * this.width;
if (width > projectAreaWidth) {
From 02e36e2637ceb3a2e69cc4281106759beae2925e Mon Sep 17 00:00:00 2001
From: Hooye!! <110253374+Davvv1@users.noreply.github.com>
Date: Mon, 23 Mar 2026 18:56:36 +0000
Subject: [PATCH 2/7] added options 'keep-height' and 'keep-width' to stage
size options
Resolves #1049
---
scaffolding-api-docs/README.md | 2 +-
src/locales/en.json | 6 ++++++
src/p4/PackagerOptions.svelte | 10 ++++++++++
src/scaffolding/scaffolding.js | 20 ++++++++++++++++++++
4 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/scaffolding-api-docs/README.md b/scaffolding-api-docs/README.md
index b25b81cd..e4ba27f1 100644
--- a/scaffolding-api-docs/README.md
+++ b/scaffolding-api-docs/README.md
@@ -111,7 +111,7 @@ Certain Scaffolding options must be configured before you can finish setting up
```js
scaffolding.width = 480; // Custom stage width
scaffolding.height = 360; // Custom stage height
-scaffolding.resizeMode = 'preserve-ratio'; // or 'dynamic-resize' or 'stretch'
+scaffolding.resizeMode = 'preserve-ratio'; // or 'dynamic-resize' or 'stretch' or 'keep-height' or 'keep-width'
scaffolding.editableLists = false; // Affects list monitors
```
diff --git a/src/locales/en.json b/src/locales/en.json
index 519efc01..c4041694 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -214,6 +214,12 @@
"dynamicResize": {
"string": "Dynamically resize size to match window size (experimental)"
},
+ "keepHeight": {
+ "string": "Preserve height when resized (experimental)"
+ },
+ "keepWidth": {
+ "string": "Preserve width when resized (experimental)"
+ },
"username": {
"string": "Username (each \"#\" gets replaced with a random number)"
},
diff --git a/src/p4/PackagerOptions.svelte b/src/p4/PackagerOptions.svelte
index 5975e2ea..48ef83a5 100644
--- a/src/p4/PackagerOptions.svelte
+++ b/src/p4/PackagerOptions.svelte
@@ -440,6 +440,16 @@
{$_('options.dynamicResize')}
+
+
diff --git a/src/scaffolding/scaffolding.js b/src/scaffolding/scaffolding.js
index 964c14bc..e7f33743 100644
--- a/src/scaffolding/scaffolding.js
+++ b/src/scaffolding/scaffolding.js
@@ -283,6 +283,26 @@ class Scaffolding extends EventTarget {
let width = projectAreaWidth;
let height = projectAreaHeight;
+ if (this.resizeMode === 'keep-height') {
+ // setStageSize is a TurboWarp-specific method
+ if (this.vm.setStageSize) {
+ this.width = width / height * this.height;
+ this.vm.setStageSize(this.width, this.height);
+ } else {
+ console.warn('keep-height not supported: vm does not implement setStageSize');
+ }
+ }
+
+ if (this.resizeMode === 'keep-width') {
+ // setStageSize is a TurboWarp-specific method
+ if (this.vm.setStageSize) {
+ this.height = height / width * this.width;
+ this.vm.setStageSize(this.width, this.height);
+ } else {
+ console.warn('keep-width not supported: vm does not implement setStageSize');
+ }
+ }
+
if (this.resizeMode !== 'stretch') {
width = height / this.height * this.width;
if (width > projectAreaWidth) {
From 6f9a536d2b729998168bfee4ba23949c1651a5f5 Mon Sep 17 00:00:00 2001
From: Hooye!! <110253374+Davvv1@users.noreply.github.com>
Date: Sun, 5 Apr 2026 05:43:18 +0000
Subject: [PATCH 3/7] Added limits to stage size
---
src/scaffolding/scaffolding.js | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/scaffolding/scaffolding.js b/src/scaffolding/scaffolding.js
index e7f33743..13f1cc9f 100644
--- a/src/scaffolding/scaffolding.js
+++ b/src/scaffolding/scaffolding.js
@@ -286,7 +286,11 @@ class Scaffolding extends EventTarget {
if (this.resizeMode === 'keep-height') {
// setStageSize is a TurboWarp-specific method
if (this.vm.setStageSize) {
- this.width = width / height * this.height;
+ if(width / height * this.height > 4320) {// clamp this.width to a size that doesn't break the project
+ this.width = width / height * this.height;
+ } else{
+ this.width = 4320;
+ }
this.vm.setStageSize(this.width, this.height);
} else {
console.warn('keep-height not supported: vm does not implement setStageSize');
@@ -296,7 +300,11 @@ class Scaffolding extends EventTarget {
if (this.resizeMode === 'keep-width') {
// setStageSize is a TurboWarp-specific method
if (this.vm.setStageSize) {
- this.height = height / width * this.width;
+ if(height / width * this.width > 4320) {// clamp this.height to a size that doesn't break the project
+ this.height = 4320
+ } else{
+ this.height = height / width * this.width;
+ }
this.vm.setStageSize(this.width, this.height);
} else {
console.warn('keep-width not supported: vm does not implement setStageSize');
From c5e379f8e349c29ceddc67df05c06540388e20a9 Mon Sep 17 00:00:00 2001
From: Hooye!! <110253374+Davvv1@users.noreply.github.com>
Date: Sun, 5 Apr 2026 05:51:28 +0000
Subject: [PATCH 4/7] Fixed keep_height limit being reversed
---
src/scaffolding/scaffolding.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/scaffolding/scaffolding.js b/src/scaffolding/scaffolding.js
index 13f1cc9f..d6b7b8fe 100644
--- a/src/scaffolding/scaffolding.js
+++ b/src/scaffolding/scaffolding.js
@@ -287,9 +287,9 @@ class Scaffolding extends EventTarget {
// setStageSize is a TurboWarp-specific method
if (this.vm.setStageSize) {
if(width / height * this.height > 4320) {// clamp this.width to a size that doesn't break the project
- this.width = width / height * this.height;
- } else{
this.width = 4320;
+ } else{
+ this.width = width / height * this.height;
}
this.vm.setStageSize(this.width, this.height);
} else {
From 7fc3144eb7576706d3c214512fec6479a4db58fb Mon Sep 17 00:00:00 2001
From: Hooye!! <110253374+Davvv1@users.noreply.github.com>
Date: Sun, 5 Apr 2026 06:05:42 +0000
Subject: [PATCH 5/7] Made the stage actually stretch when clamping size
---
src/scaffolding/scaffolding.js | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/scaffolding/scaffolding.js b/src/scaffolding/scaffolding.js
index d6b7b8fe..2692f685 100644
--- a/src/scaffolding/scaffolding.js
+++ b/src/scaffolding/scaffolding.js
@@ -286,8 +286,15 @@ class Scaffolding extends EventTarget {
if (this.resizeMode === 'keep-height') {
// setStageSize is a TurboWarp-specific method
if (this.vm.setStageSize) {
- if(width / height * this.height > 4320) {// clamp this.width to a size that doesn't break the project
- this.width = 4320;
+ if(width / height * this.height > 8640) {// clamp this.width to a size that doesn't break the project
+ this.width = 8640;
+
+ width = height / this.height * this.width; // Stretch the stage to fit window when size clamped
+ if (width > projectAreaWidth) {
+ height = projectAreaWidth / this.width * this.height;
+ width = projectAreaWidth;
+ }
+
} else{
this.width = width / height * this.height;
}
@@ -300,8 +307,15 @@ class Scaffolding extends EventTarget {
if (this.resizeMode === 'keep-width') {
// setStageSize is a TurboWarp-specific method
if (this.vm.setStageSize) {
- if(height / width * this.width > 4320) {// clamp this.height to a size that doesn't break the project
- this.height = 4320
+ if(height / width * this.width > 8640) {// clamp this.height to a size that doesn't break the project
+ this.height = 8640
+
+ width = height / this.height * this.width; // Stretch the stage to fit window when size clamped
+ if (width > projectAreaWidth) {
+ height = projectAreaWidth / this.width * this.height;
+ width = projectAreaWidth;
+ }
+
} else{
this.height = height / width * this.width;
}
From 89abfa9de6491c9e17f579f2cafa678ea3e1f2d4 Mon Sep 17 00:00:00 2001
From: Hooye!! <110253374+Davvv1@users.noreply.github.com>
Date: Sun, 5 Apr 2026 21:00:51 +0000
Subject: [PATCH 6/7] Made the stage actually ACTUALLY stretch this time
Listen, this is my first time doing this. Cut me some slack.
---
src/scaffolding/scaffolding.js | 34 +++++++++++++---------------------
1 file changed, 13 insertions(+), 21 deletions(-)
diff --git a/src/scaffolding/scaffolding.js b/src/scaffolding/scaffolding.js
index 2692f685..0e966424 100644
--- a/src/scaffolding/scaffolding.js
+++ b/src/scaffolding/scaffolding.js
@@ -258,6 +258,14 @@ class Scaffolding extends EventTarget {
this.relayout();
}
+ _dontstretch () {
+ width = height / this.height * this.width;
+ if (width > projectAreaWidth) {
+ height = projectAreaWidth / this.width * this.height;
+ width = projectAreaWidth;
+ }
+ }
+
relayout () {
const totalWidth = Math.max(1, this._root.offsetWidth);
const totalHeight = Math.max(1, this._root.offsetHeight);
@@ -288,15 +296,9 @@ class Scaffolding extends EventTarget {
if (this.vm.setStageSize) {
if(width / height * this.height > 8640) {// clamp this.width to a size that doesn't break the project
this.width = 8640;
-
- width = height / this.height * this.width; // Stretch the stage to fit window when size clamped
- if (width > projectAreaWidth) {
- height = projectAreaWidth / this.width * this.height;
- width = projectAreaWidth;
- }
-
} else{
this.width = width / height * this.height;
+ this._dontstretch();
}
this.vm.setStageSize(this.width, this.height);
} else {
@@ -308,16 +310,10 @@ class Scaffolding extends EventTarget {
// setStageSize is a TurboWarp-specific method
if (this.vm.setStageSize) {
if(height / width * this.width > 8640) {// clamp this.height to a size that doesn't break the project
- this.height = 8640
-
- width = height / this.height * this.width; // Stretch the stage to fit window when size clamped
- if (width > projectAreaWidth) {
- height = projectAreaWidth / this.width * this.height;
- width = projectAreaWidth;
- }
-
+ this.height = 8640;
} else{
this.height = height / width * this.width;
+ this._dontstretch();
}
this.vm.setStageSize(this.width, this.height);
} else {
@@ -325,12 +321,8 @@ class Scaffolding extends EventTarget {
}
}
- if (this.resizeMode !== 'stretch') {
- width = height / this.height * this.width;
- if (width > projectAreaWidth) {
- height = projectAreaWidth / this.width * this.height;
- width = projectAreaWidth;
- }
+ if (this.resizeMode !== 'stretch' && this.resizeMode !== 'keep_width' && this.resizeMode !== 'keep_height') {
+ this._dontstretch();
}
const distanceFromTop = totalHeight - height;
From 6413113f85f32f8249af4460a8d9143c9064267c Mon Sep 17 00:00:00 2001
From: Hooye!! <110253374+Davvv1@users.noreply.github.com>
Date: Sun, 5 Apr 2026 21:11:20 +0000
Subject: [PATCH 7/7] When it broke, you fix it I really need to get better at
this.
---
src/scaffolding/scaffolding.js | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/scaffolding/scaffolding.js b/src/scaffolding/scaffolding.js
index 0e966424..d9c42e38 100644
--- a/src/scaffolding/scaffolding.js
+++ b/src/scaffolding/scaffolding.js
@@ -258,14 +258,6 @@ class Scaffolding extends EventTarget {
this.relayout();
}
- _dontstretch () {
- width = height / this.height * this.width;
- if (width > projectAreaWidth) {
- height = projectAreaWidth / this.width * this.height;
- width = projectAreaWidth;
- }
- }
-
relayout () {
const totalWidth = Math.max(1, this._root.offsetWidth);
const totalHeight = Math.max(1, this._root.offsetHeight);
@@ -298,7 +290,6 @@ class Scaffolding extends EventTarget {
this.width = 8640;
} else{
this.width = width / height * this.height;
- this._dontstretch();
}
this.vm.setStageSize(this.width, this.height);
} else {
@@ -310,10 +301,9 @@ class Scaffolding extends EventTarget {
// setStageSize is a TurboWarp-specific method
if (this.vm.setStageSize) {
if(height / width * this.width > 8640) {// clamp this.height to a size that doesn't break the project
- this.height = 8640;
+ this.height = 8640
} else{
this.height = height / width * this.width;
- this._dontstretch();
}
this.vm.setStageSize(this.width, this.height);
} else {
@@ -322,7 +312,11 @@ class Scaffolding extends EventTarget {
}
if (this.resizeMode !== 'stretch' && this.resizeMode !== 'keep_width' && this.resizeMode !== 'keep_height') {
- this._dontstretch();
+ width = height / this.height * this.width;
+ if (width > projectAreaWidth) {
+ height = projectAreaWidth / this.width * this.height;
+ width = projectAreaWidth;
+ }
}
const distanceFromTop = totalHeight - height;