diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index e491db0..0cf9674 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -24,3 +24,20 @@ jobs:
- name: Run Tests
run: npx vitest run
+
+ build-cloudflare:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version-file: .nvmrc
+
+ - name: Install Dependencies
+ run: npm ci
+
+ - name: Build for Cloudflare Pages
+ run: npm run build
+ env:
+ NITRO_PRESET: cloudflare-pages
+ NODE_OPTIONS: --max-old-space-size=4096
diff --git a/app/components/ButtonTheme.vue b/app/components/ButtonTheme.vue
index 0879dbf..919bd77 100644
--- a/app/components/ButtonTheme.vue
+++ b/app/components/ButtonTheme.vue
@@ -60,9 +60,9 @@
diff --git a/app/components/Canvas.vue b/app/components/Canvas.vue
index 877ddf8..5ef6bab 100644
--- a/app/components/Canvas.vue
+++ b/app/components/Canvas.vue
@@ -135,7 +135,7 @@ const props = defineProps({
themeType: { type: String, default: 'dark' },
});
-const emit = defineEmits(['update:width', 'update:height']);
+const emit = defineEmits(['update:width', 'update:height', 'resize-start', 'resize-end']);
const x = ref(null);
const y = ref(null);
@@ -159,6 +159,10 @@ const { zoom, aspectRatio } = toRefs(props);
let resizeObserver = null;
let observedSceneWindow = null;
let sceneMetricsRequest = null;
+let resizeRequest = null;
+let pendingResize = null;
+let resizeScaleX = 1;
+let resizeScaleY = 1;
const ratio = computed(() => {
if (aspectRatio.value) {
@@ -186,22 +190,55 @@ function onResizeStart(event) {
resizingWidth.value = hasWidth || !!ratio.value;
resizingHeight.value = hasHeight || !!ratio.value;
+
+ const container = event.target.parentNode;
+ const containerRect = container.getBoundingClientRect();
+
+ resizeScaleX = containerRect.width / container.offsetWidth || 1;
+ resizeScaleY = containerRect.height / container.offsetHeight || 1;
+
+ emit('resize-start');
}
function onResizeEnd() {
+ flushResize();
+
resizingWidth.value = false;
resizingHeight.value = false;
+
+ emit('resize-end');
}
function onResize(event) {
- const container = event.target.parentNode;
- if (event.rect.width) {
- const scaleX = container.getBoundingClientRect().width / container.offsetWidth;
- emit('update:width', event.rect.width / scaleX);
+ pendingResize = {
+ width: event.rect.width,
+ height: event.rect.height,
+ };
+
+ if (!resizeRequest) {
+ resizeRequest = requestAnimationFrame(flushResize);
+ }
+}
+
+function flushResize() {
+ if (resizeRequest) {
+ cancelAnimationFrame(resizeRequest);
+ resizeRequest = null;
+ }
+
+ if (!pendingResize) {
+ return;
+ }
+
+ const { width, height } = pendingResize;
+ pendingResize = null;
+
+ if (width) {
+ emit('update:width', width / resizeScaleX);
}
- if (event.rect.height) {
- const scaleY = container.getBoundingClientRect().height / container.offsetHeight;
- emit('update:height', event.rect.height / scaleY);
+
+ if (height) {
+ emit('update:height', height / resizeScaleY);
}
}
@@ -275,6 +312,10 @@ onBeforeUnmount(() => {
cancelAnimationFrame(sceneMetricsRequest);
}
+ if (resizeRequest) {
+ cancelAnimationFrame(resizeRequest);
+ }
+
resizeObserver?.disconnect();
});
diff --git a/app/components/Editor.vue b/app/components/Editor.vue
index f4ba2b6..f18ed6a 100644
--- a/app/components/Editor.vue
+++ b/app/components/Editor.vue
@@ -147,8 +147,6 @@
{
- updateMonacoDimensions();
- watch([sizes, orientation], updateMonacoDimensions);
- $bus.$on('editors:refresh', updateMonacoDimensions);
-});
-
onUnmounted(() => $bus.$emit('editors:refresh'));
diff --git a/app/components/Monaco.vue b/app/components/Monaco.client.vue
similarity index 64%
rename from app/components/Monaco.vue
rename to app/components/Monaco.client.vue
index aea1b90..e94be4e 100644
--- a/app/components/Monaco.vue
+++ b/app/components/Monaco.client.vue
@@ -1,13 +1,24 @@
-
+
diff --git a/app/components/TabBackgrounds.vue b/app/components/TabBackgrounds.vue
index fe29ac1..b7edaae 100644
--- a/app/components/TabBackgrounds.vue
+++ b/app/components/TabBackgrounds.vue
@@ -52,7 +52,8 @@
:data-ref="`button-background-${id}`"
:active="background === id && !backgroundColor"
@delete="$emit('delete', id)"
- @click="$emit('select', id)"
+ @mousedown.prevent
+ @click="selectBackground($event, id)"
/>
@@ -62,7 +63,7 @@
diff --git a/app/components/TabScenes.vue b/app/components/TabScenes.vue
index e1deda8..30e0f41 100644
--- a/app/components/TabScenes.vue
+++ b/app/components/TabScenes.vue
@@ -4,6 +4,7 @@