Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions app/components/Window.vue
Original file line number Diff line number Diff line change
Expand Up @@ -994,16 +994,8 @@
border-left: 1px solid var(--scene-grid-color, #353535);
}

.window-scene-elevenlabs .exclude-from-panzoom::before {
position: absolute;
top: 0;
right: calc(-1 * var(--scene-gutter-right, 150px));
left: calc(-1 * var(--scene-gutter-left, 150px));
.window-scene-elevenlabs:not(.window-header-hidden) .scene-eleven-grid-horizontal-top {
z-index: 3;
height: 1px;
background: var(--scene-grid-color, #353535);
content: '';
pointer-events: none;
}

.window-scene-elevenlabs .code-window-content {
Expand Down Expand Up @@ -1089,7 +1081,7 @@ function actualWidth() {
const widths = [rootRect.width / scale, root.value.clientWidth];

root.value.querySelectorAll('*').forEach((element) => {
if (element.closest('[data-hide]')) return;
if (element.closest('[data-hide], .scene-window-decoration')) return;

const rect = element.getBoundingClientRect();

Expand All @@ -1110,7 +1102,7 @@ function actualHeight() {
const heights = [rootRect.height / scale, root.value.clientHeight];

root.value.querySelectorAll('*').forEach((element) => {
if (element.closest('[data-hide]')) return;
if (element.closest('[data-hide], .scene-window-decoration')) return;

const rect = element.getBoundingClientRect();

Expand Down
20 changes: 20 additions & 0 deletions tests/components/Window.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ import Window from '~/components/Window.vue';
import useSettings from '~/composables/useSettings';

describe('Window', () => {
it('excludes Cloudflare grid overflow from fitted dimensions', () => {
const { settings } = useSettings({ scene: 'cloudflare' });
const wrapper = mount(Window, { props: { settings, preview: true } });

const root = wrapper.element;
const horizontal = root.querySelector('.scene-grid-horizontal');
const vertical = root.querySelector('.scene-grid-vertical');
const rect = new DOMRect(0, 0, 360, 116);

vi.spyOn(root, 'getBoundingClientRect').mockReturnValue(rect);
vi.spyOn(horizontal, 'getBoundingClientRect').mockReturnValue(rect);
vi.spyOn(vertical, 'getBoundingClientRect').mockReturnValue(rect);
Object.defineProperty(horizontal, 'scrollWidth', { value: 420 });
Object.defineProperty(vertical, 'scrollHeight', { value: 127 });

vi.spyOn(root, 'querySelectorAll').mockReturnValue([horizontal, vertical]);
expect([wrapper.vm.actualWidth(), wrapper.vm.actualHeight()]).toEqual([360, 116]);
wrapper.unmount();
});

it.each([
{ zoom: 0.5, scale: 1, scene: 'none' },
{ zoom: 1, scale: 1, scene: 'none' },
Expand Down
Loading