mirror of
https://github.com/imgfloat/server.git
synced 2026-02-05 03:39:26 +00:00
Clean up zindex
This commit is contained in:
@@ -688,12 +688,14 @@ export function createAdminConsole({
|
|||||||
if (!isAudio && Number.isFinite(targetOrder)) {
|
if (!isAudio && Number.isFinite(targetOrder)) {
|
||||||
if (isScript) {
|
if (isScript) {
|
||||||
const currentOrder = getScriptLayerOrder().filter((id) => id !== assetId);
|
const currentOrder = getScriptLayerOrder().filter((id) => id !== assetId);
|
||||||
const insertIndex = Math.max(0, currentOrder.length - Math.round(targetOrder));
|
const totalCount = currentOrder.length + 1;
|
||||||
|
const insertIndex = Math.max(0, Math.min(currentOrder.length, totalCount - Math.round(targetOrder)));
|
||||||
currentOrder.splice(insertIndex, 0, assetId);
|
currentOrder.splice(insertIndex, 0, assetId);
|
||||||
scriptLayerOrder = currentOrder;
|
scriptLayerOrder = currentOrder;
|
||||||
} else {
|
} else {
|
||||||
const currentOrder = getLayerOrder().filter((id) => id !== assetId);
|
const currentOrder = getLayerOrder().filter((id) => id !== assetId);
|
||||||
const insertIndex = Math.max(0, currentOrder.length - Math.round(targetOrder));
|
const totalCount = currentOrder.length + 1;
|
||||||
|
const insertIndex = Math.max(0, Math.min(currentOrder.length, totalCount - Math.round(targetOrder)));
|
||||||
currentOrder.splice(insertIndex, 0, assetId);
|
currentOrder.splice(insertIndex, 0, assetId);
|
||||||
layerOrder = currentOrder;
|
layerOrder = currentOrder;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,17 +291,19 @@ export class BroadcastRenderer {
|
|||||||
this.hideAssetWithTransition(merged);
|
this.hideAssetWithTransition(merged);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const targetOrder = Number.isFinite(patch.order) ? patch.order : null;
|
const targetOrder = Number.isFinite(sanitizedPatch.order) ? sanitizedPatch.order : null;
|
||||||
if (Number.isFinite(targetOrder)) {
|
if (Number.isFinite(targetOrder)) {
|
||||||
if (isScript) {
|
if (isScript) {
|
||||||
const currentOrder = getScriptLayerOrder(this.state).filter((id) => id !== assetId);
|
const currentOrder = getScriptLayerOrder(this.state).filter((id) => id !== assetId);
|
||||||
const insertIndex = Math.max(0, currentOrder.length - Math.round(targetOrder));
|
const totalCount = currentOrder.length + 1;
|
||||||
|
const insertIndex = Math.max(0, Math.min(currentOrder.length, totalCount - Math.round(targetOrder)));
|
||||||
currentOrder.splice(insertIndex, 0, assetId);
|
currentOrder.splice(insertIndex, 0, assetId);
|
||||||
this.state.scriptLayerOrder = currentOrder;
|
this.state.scriptLayerOrder = currentOrder;
|
||||||
this.applyScriptCanvasOrder();
|
this.applyScriptCanvasOrder();
|
||||||
} else if (isVisual) {
|
} else if (isVisual) {
|
||||||
const currentOrder = getLayerOrder(this.state).filter((id) => id !== assetId);
|
const currentOrder = getLayerOrder(this.state).filter((id) => id !== assetId);
|
||||||
const insertIndex = Math.max(0, currentOrder.length - Math.round(targetOrder));
|
const totalCount = currentOrder.length + 1;
|
||||||
|
const insertIndex = Math.max(0, Math.min(currentOrder.length, totalCount - Math.round(targetOrder)));
|
||||||
currentOrder.splice(insertIndex, 0, assetId);
|
currentOrder.splice(insertIndex, 0, assetId);
|
||||||
this.state.layerOrder = currentOrder;
|
this.state.layerOrder = currentOrder;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user