From f8984174e0948ff64cef7e54e827be54d36c5fe6 Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Sat, 7 Oct 2023 13:18:39 +0200 Subject: [PATCH] live preview of multiple props at the same time --- bin/web/js/audio.js | 15 +++++++++++++-- bin/web/js/record.js | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/web/js/audio.js b/bin/web/js/audio.js index 8e3eef8..088b899 100644 --- a/bin/web/js/audio.js +++ b/bin/web/js/audio.js @@ -629,10 +629,21 @@ const Audio = function(tp, record) { } }; } + let values = {}; propsToSet.forEach((p) => { - immediateUpdate(p.layer, { + const newValues = { [p.title]: p.value - }); + }; + if (!values.hasOwnProperty(p.id)) { + values[p.id] = {}; + } + values[p.id] = { + ...values[p.id], + ...newValues, + }; + }); + Object.keys(values).forEach((layerID) => { + immediateUpdate(getLayer(layerID), values[layerID]); }); } } else { diff --git a/bin/web/js/record.js b/bin/web/js/record.js index 0d7a1bc..1a654d5 100644 --- a/bin/web/js/record.js +++ b/bin/web/js/record.js @@ -304,6 +304,7 @@ const Record = function(tp) { }; const startRecording = () => { + console.log('Record::startRecording'); tp.sheet.sequence.pause(); const layerKeys = Object.keys(hot); layerKeys.forEach((layerID) => { @@ -327,7 +328,8 @@ const Record = function(tp) { [propTitle]: value, }; buffy.addValues(layerID, recording, position, lastPosition); - liveUpdater.immediateUpdate(layer, recording); + const merged = buffy.getValues(layerID, position); + liveUpdater.immediateUpdate(layer, merged); lastPosition = position; }); } else {