fix: preserve stack primary asset selection (#31380)
* fix: preserve stack primary asset selection * test: select stacked assets by id * chore: limit dart formatting changes * fix: address stack viewer review feedback * fix: align stack ordering with server * fix: keep stack primary asset first --------- Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> (cherry picked from commit 5a5d7be11084969c3c00a294ce6c0527042f88e7)
This commit is contained in:
@@ -291,16 +291,15 @@
|
||||
if (!stack || !withStacked || assetViewerManager.isShowEditor) {
|
||||
return;
|
||||
}
|
||||
const assets = stack.assets;
|
||||
const currentIndex = assets.findIndex(({ id }) => id === asset.id);
|
||||
const currentIndex = stack.assets.findIndex(({ id }) => id === asset.id);
|
||||
if (currentIndex === -1) {
|
||||
return;
|
||||
}
|
||||
const nextIndex = direction === 'previous' ? currentIndex - 1 : currentIndex + 1;
|
||||
if (nextIndex < 0 || nextIndex >= assets.length) {
|
||||
if (nextIndex < 0 || nextIndex >= stack.assets.length) {
|
||||
return;
|
||||
}
|
||||
cursor.current = assets[nextIndex];
|
||||
cursor.current = stack.assets[nextIndex];
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+3
-1
@@ -94,7 +94,9 @@
|
||||
};
|
||||
|
||||
const handleStack = () => {
|
||||
onStack(assets);
|
||||
const selectedAssets = assets.filter(({ id }) => selectedAssetIds.has(id));
|
||||
const unselectedAssets = assets.filter(({ id }) => !selectedAssetIds.has(id));
|
||||
onStack([...selectedAssets, ...unselectedAssets]);
|
||||
};
|
||||
|
||||
const assetCursor = $derived({
|
||||
|
||||
Reference in New Issue
Block a user