@7365admin1/layer-common 4.17.1-staging.337 → 4.17.1-staging.338
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/CameraWall.vue +3 -1
- package/package.json +1 -1
- package/utils/camera-wall.ts +15 -3
|
@@ -516,7 +516,6 @@ const layout = computed(() => wallLayout(layoutKey.value));
|
|
|
516
516
|
* `camera-wall.ts` (see `wallColumns`) so they stay testable there.
|
|
517
517
|
*/
|
|
518
518
|
const { smAndDown } = useDisplay();
|
|
519
|
-
const columns = computed(() => wallColumns(layoutKey.value, smAndDown.value));
|
|
520
519
|
const dense = computed(() => isDenseLayout(layoutKey.value, smAndDown.value));
|
|
521
520
|
|
|
522
521
|
const selectedIds = ref<string[]>([]);
|
|
@@ -531,6 +530,9 @@ const tiles = computed(() =>
|
|
|
531
530
|
wallTiles(cameras.value, selectedIds.value, layoutKey.value, page.value)
|
|
532
531
|
);
|
|
533
532
|
|
|
533
|
+
/** Declared after `tiles`: the columns follow how many tiles are actually shown. */
|
|
534
|
+
const columns = computed(() => wallColumns(layoutKey.value, smAndDown.value, tiles.value.length));
|
|
535
|
+
|
|
534
536
|
/**
|
|
535
537
|
* THE GRID PACKS TO WHAT IS ON IT.
|
|
536
538
|
*
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.17.1-staging.
|
|
5
|
+
"version": "4.17.1-staging.338",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
package/utils/camera-wall.ts
CHANGED
|
@@ -126,8 +126,20 @@ export function wallLayout(key: string | undefined) {
|
|
|
126
126
|
* are untouched — `isPhone` is the caller's own `smAndDown` (or equivalent),
|
|
127
127
|
* this file has no notion of viewport width itself.
|
|
128
128
|
*/
|
|
129
|
-
export function wallColumns(
|
|
130
|
-
|
|
129
|
+
export function wallColumns(
|
|
130
|
+
key: string | undefined,
|
|
131
|
+
isPhone = false,
|
|
132
|
+
/** How many tiles are actually on screen. Fewer tiles than the layout holds means fewer columns. */
|
|
133
|
+
count?: number
|
|
134
|
+
): number {
|
|
135
|
+
const base = isPhone ? 1 : wallLayout(key).columns;
|
|
136
|
+
if (!Number.isFinite(count as number)) return base;
|
|
137
|
+
const shown = Math.max(0, Math.floor(count as number));
|
|
138
|
+
// One camera on a four-tile wall used to keep two columns, so the picture
|
|
139
|
+
// took half the width and the rest of the screen was black. The layout
|
|
140
|
+
// button is a MAXIMUM ("up to this many tiles"), not a promise to leave
|
|
141
|
+
// empty cells: the grid never draws more columns than it has tiles to fill.
|
|
142
|
+
return shown > 0 ? Math.min(base, shown) : base;
|
|
131
143
|
}
|
|
132
144
|
|
|
133
145
|
/**
|
|
@@ -340,8 +352,8 @@ export function wallRows(
|
|
|
340
352
|
isPhone = false
|
|
341
353
|
): number {
|
|
342
354
|
const { tiles } = wallLayout(layoutKey);
|
|
343
|
-
const columns = wallColumns(layoutKey, isPhone);
|
|
344
355
|
const capped = Math.min(Math.max(0, Math.floor(count)), tiles);
|
|
356
|
+
const columns = wallColumns(layoutKey, isPhone, capped);
|
|
345
357
|
return Math.min(Math.ceil(tiles / columns), Math.max(1, Math.ceil(capped / columns)));
|
|
346
358
|
}
|
|
347
359
|
|