@bwp-web/canvas 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2566,6 +2566,16 @@ function useEditCanvas(options) {
2566
2566
  canvas.on("object:modified", markDirtyIfNotLoading);
2567
2567
  canvas.on("background:modified", markDirtyIfNotLoading);
2568
2568
  }
2569
+ canvas.on("object:added", (e) => {
2570
+ if (!isInitialLoadRef.current && e.target) {
2571
+ setObjects((prev) => [...prev, e.target]);
2572
+ }
2573
+ });
2574
+ canvas.on("object:removed", (e) => {
2575
+ if (!isInitialLoadRef.current && e.target) {
2576
+ setObjects((prev) => prev.filter((o) => o !== e.target));
2577
+ }
2578
+ });
2569
2579
  if (opts?.history) {
2570
2580
  const syncHistoryState = () => {
2571
2581
  const h = historyRef.current;