Add comments explaining Fabric listeners

This commit is contained in:
Evan Hahn 2022-01-11 17:18:19 -06:00 committed by GitHub
parent ace90c9d7a
commit 2dded88081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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 <http://fabricjs.com/docs/fabric.Canvas.html#Canvas> for the list of events.
['object:added', 'object:modified', 'object:removed'],
({ target }) => {
if (isTimeTraveling || target?.excludeFromExport) {