From 4e5a75074acd15587c305dd8ca8ff655031d38a6 Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Sun, 18 Jun 2023 00:58:54 -0400 Subject: [PATCH] Fix tiles not collapsing toward their center --- src/video-grid/model.ts | 4 ++-- test/video-grid/model-test.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/video-grid/model.ts b/src/video-grid/model.ts index 5150ace..15973c4 100644 --- a/src/video-grid/model.ts +++ b/src/video-grid/model.ts @@ -543,8 +543,8 @@ export function cycleTileSize(tileId: string, g: Grid): Grid { // To make the tile appear to expand outwards from its center, we're actually // scanning for locations to put the *center* of the tile. These numbers are // the offsets between the tile's origin and its center. - const scanColumnOffset = Math.floor((toWidth - 1) / 2); - const scanRowOffset = Math.floor((toHeight - 1) / 2); + const scanColumnOffset = Math.floor((toWidth - fromWidth) / 2); + const scanRowOffset = Math.floor((toHeight - fromHeight) / 2); const nextScanLocations = new Set([from]); const rows = row(g.cells.length - 1, g) + 1; diff --git a/test/video-grid/model-test.ts b/test/video-grid/model-test.ts index f7d0330..479f9cb 100644 --- a/test/video-grid/model-test.ts +++ b/test/video-grid/model-test.ts @@ -273,9 +273,9 @@ dbbe fghi jk`, ` -abhc -djge -fik` +akbc +djhe +fig` ); testCycleTileSize(