From 2dded88081cd92e342dcedb5e3604ff9ed99fbc0 Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Tue, 11 Jan 2022 17:18:19 -0600 Subject: [PATCH] Add comments explaining Fabric listeners --- ts/mediaEditor/useFabricHistory.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ts/mediaEditor/useFabricHistory.ts b/ts/mediaEditor/useFabricHistory.ts index 9f23b61c1..0eca42700 100644 --- a/ts/mediaEditor/useFabricHistory.ts +++ b/ts/mediaEditor/useFabricHistory.ts @@ -186,6 +186,12 @@ export function useFabricHistory({ } return fabricEffectListener( fabricCanvas, + // We want to take snapshots when objects are added, removed, and modified. The + // first two are obvious. We DON'T want to take snapshots before those things + // happen (like `object:moving`), and we also don't want to take redundant ones + // (which is why we don't listen to both `object:modified` and `object:rotated`). + // + // See for the list of events. ['object:added', 'object:modified', 'object:removed'], ({ target }) => { if (isTimeTraveling || target?.excludeFromExport) {