FIX: sửa UNDO/REDO bị lỗi màn hình đen
This commit is contained in:
+28
-29
@@ -12270,29 +12270,28 @@ const App = () => {
|
||||
var newItemId = Object.keys(newOriginals)[0] || itemId;
|
||||
var origPos = newOriginals[newItemId] || { start: 0 };
|
||||
setDraggedSectionItem({ trackId, itemType, itemId: newItemId, clickOffset, multiIds: newOriginals, originalPositions: { [newItemId]: origPos.start } });
|
||||
} else {
|
||||
var items = itemType === 'section' ? (track.sections || []) : (track.midiItems || []);
|
||||
var item = items.find(function(it) { return it.id === itemId; });
|
||||
if (!item) return;
|
||||
var rearrangeNewId = itemType + '_dup_' + Date.now();
|
||||
var newItem = { ...item, id: rearrangeNewId, name: item.name + ' (Copy)' };
|
||||
updateActiveTracks(function(prev) {
|
||||
return prev.map(function(t) {
|
||||
if (t.id !== trackId) return t;
|
||||
var updated = itemType === 'section' ? [...(t.sections || []), newItem] : [...(t.midiItems || []), newItem];
|
||||
return itemType === 'section' ? { ...t, sections: updated } : { ...t, midiItems: updated };
|
||||
});
|
||||
});
|
||||
setDraggedSectionItem({ trackId, itemType, itemId: rearrangeNewId, clickOffset, isDuplicate: false, originalPositions: { [rearrangeNewId]: itemType === 'section' ? item.start : item.startTime } });
|
||||
}
|
||||
return;
|
||||
}
|
||||
var curTrk = activeTracksRef.current ? activeTracksRef.current.find(t => t.id === trackId) : null;
|
||||
var its = itemType === 'section' ? (curTrk?.sections || []) : (curTrk?.midiItems || []);
|
||||
var it = its.find(function(x) { return x.id === itemId; });
|
||||
var origPos = it ? (itemType === 'section' ? it.start : it.startTime) : 0;
|
||||
setDraggedSectionItem({ trackId, itemType, itemId, clickOffset, multiIds, originalPositions: { [itemId]: origPos } });
|
||||
};
|
||||
} else {
|
||||
var items = itemType === 'section' ? (track.sections || []) : (track.midiItems || []);
|
||||
var item = items.find(function(it) { return it.id === itemId; });
|
||||
if (!item) return;
|
||||
var rearrangeNewId = itemType + '_dup_' + Date.now();
|
||||
var newItem = { ...item, id: rearrangeNewId, name: item.name + ' (Copy)' };
|
||||
updateActiveTracks(function(prev) {
|
||||
return prev.map(function(t) {
|
||||
if (t.id !== trackId) return t;
|
||||
var updated = itemType === 'section' ? [...(t.sections || []), newItem] : [...(t.midiItems || []), newItem];
|
||||
return itemType === 'section' ? { ...t, sections: updated } : { ...t, midiItems: updated };
|
||||
});
|
||||
});
|
||||
setDraggedSectionItem({ trackId, itemType, itemId: rearrangeNewId, clickOffset, isDuplicate: false, originalPositions: { [rearrangeNewId]: itemType === 'section' ? item.start : item.startTime } });
|
||||
}
|
||||
} else {
|
||||
var curTrk = activeTracksRef.current ? activeTracksRef.current.find(t => t.id === trackId) : null;
|
||||
var its = itemType === 'section' ? (curTrk?.sections || []) : (curTrk?.midiItems || []);
|
||||
var it = its.find(function(x) { return x.id === itemId; });
|
||||
var origPos = it ? (itemType === 'section' ? it.start : it.startTime) : 0;
|
||||
setDraggedSectionItem({ trackId, itemType, itemId, clickOffset, multiIds, originalPositions: { [itemId]: origPos } });
|
||||
}
|
||||
};
|
||||
handleSectionItemDragStartRef.current = handleSectionItemDragStart;
|
||||
|
||||
@@ -17099,9 +17098,9 @@ setDraggedSectionItem({ trackId, itemType, itemId, clickOffset, multiIds, origin
|
||||
className: "w-12 bg-zinc-800 border border-zinc-700 rounded text-xs text-zinc-300 text-center font-mono focus:outline-none focus:border-purple-500",
|
||||
min: "40",
|
||||
max: "300"
|
||||
}), /*#__PURE__*/React.createElement("span",
|
||||
className: "text-xs text-zinc-500"
|
||||
}, "BPM")))), /*#__PURE__*/React.createElement("div", {
|
||||
}), /*#__PURE__*/React.createElement("span", {
|
||||
className: "text-xs text-zinc-500"
|
||||
}, "BPM")))), /*#__PURE__*/React.createElement("div", {
|
||||
className: "flex-1 flex flex-col divide-y divide-[#141414] bg-[#262626]"
|
||||
}, activeTracks.length === 0 ? /*#__PURE__*/React.createElement("div", {
|
||||
className: "p-6 text-center text-zinc-400 flex flex-col items-center justify-center space-y-3"
|
||||
@@ -18691,7 +18690,7 @@ setDraggedSectionItem({ trackId, itemType, itemId, clickOffset, multiIds, origin
|
||||
/*#__PURE__*/React.createElement("div", { className: "flex gap-4", style: { height: "420px" } },
|
||||
/*#__PURE__*/React.createElement("div", { className: "w-1/3 border-r border-[#383838] overflow-y-auto space-y-0.5 pr-2" },
|
||||
/*#__PURE__*/React.createElement("button", {
|
||||
onClick: () => setSelectedSoundFontId(null); setSynthCategory(null); },
|
||||
onClick: () => { setSelectedSoundFontId(null); setSynthCategory(null); },
|
||||
className: "w-full text-left px-3 py-2 text-sm rounded " + (!selectedSoundFontId ? "bg-amber-700 text-white" : "bg-zinc-800 hover:bg-zinc-700 text-zinc-300")
|
||||
}, "All Instruments"),
|
||||
(instrumentSelectorData?.soundfonts || []).map(sf => {
|
||||
@@ -18744,7 +18743,7 @@ setDraggedSectionItem({ trackId, itemType, itemId, clickOffset, multiIds, origin
|
||||
)
|
||||
)
|
||||
)
|
||||
)), fxSelectorTrackId && /*#__PURE__*/React.createElement("div", {
|
||||
), fxSelectorTrackId && /*#__PURE__*/React.createElement("div", {
|
||||
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",
|
||||
onClick: () => setFxSelectorTrackId(null)
|
||||
}, /*#__PURE__*/React.createElement("div", {
|
||||
@@ -18754,7 +18753,7 @@ setDraggedSectionItem({ trackId, itemType, itemId, clickOffset, multiIds, origin
|
||||
/*#__PURE__*/React.createElement("button", { onClick: () => handleSetTrackFx(fxSelectorTrackId, null), className: "w-full text-left px-3 py-2 text-xs rounded bg-zinc-800 hover:bg-zinc-700 text-zinc-400" }, "None"),
|
||||
/*#__PURE__*/React.createElement("button", { onClick: () => handleSetTrackFx(fxSelectorTrackId, 'chorus'), className: "w-full text-left px-3 py-2 text-xs rounded bg-zinc-800 hover:bg-cyan-800 text-cyan-300" }, "Chorus"),
|
||||
/*#__PURE__*/React.createElement("button", { onClick: () => handleSetTrackFx(fxSelectorTrackId, 'reverb'), className: "w-full text-left px-3 py-2 text-xs rounded bg-zinc-800 hover:bg-purple-800 text-purple-300" }, "Reverb")
|
||||
), instrumentDropdownTrackId && instrumentDropdownBtnRect && /*#__PURE__*/React.createElement("div", {
|
||||
))), instrumentDropdownTrackId && instrumentDropdownBtnRect && /*#__PURE__*/React.createElement("div", {
|
||||
"data-instr-dropdown": "",
|
||||
className: "fixed z-[100] bg-[#1e1e1e] border border-zinc-700 rounded shadow-xl w-[220px] max-h-[300px] flex flex-col",
|
||||
style: {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user