@mgamadeus/ddd-design-studio 0.3.0 → 0.3.2

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.
@@ -568,6 +568,14 @@ var findSectionAt = (sections, x, y) => {
568
568
  }
569
569
  return nearest;
570
570
  };
571
+ var findSectionPresentationStart = (sections, selectedBoardId, sectionInView) => {
572
+ if (selectedBoardId) {
573
+ const sectionOfSelectedBoard = sections.find((section) => section.boardIds.includes(selectedBoardId));
574
+ if (sectionOfSelectedBoard) return { sectionId: sectionOfSelectedBoard.id, boardId: selectedBoardId };
575
+ }
576
+ const firstBoardId = sectionInView?.boardIds[0];
577
+ return sectionInView && firstBoardId ? { sectionId: sectionInView.id, boardId: firstBoardId } : void 0;
578
+ };
571
579
 
572
580
  // src/canvas/canvasLiveUpdate.ts
573
581
  var VIEWPORT_MIN_ZOOM = 1e-3;
@@ -1917,8 +1925,8 @@ var FlowCanvas = ({
1917
1925
  if (section) fitNodes([sectionNodeId(section.id)]);
1918
1926
  };
1919
1927
  const presentCurrentSection = () => {
1920
- const section = sectionInView();
1921
- if (section) onPresentSection(section.id);
1928
+ const presentationStart = findSectionPresentationStart(layout.sections, selectedNodeId, sectionInView());
1929
+ if (presentationStart) onPresentSection(presentationStart.sectionId, presentationStart.boardId);
1922
1930
  };
1923
1931
  const [marquee, setMarquee] = useState7(null);
1924
1932
  const isMarqueeJustEndedRef = useRef2(false);
@@ -2556,8 +2564,9 @@ var DesignStudioCanvasScreen = ({ projectKey, canvasKey }) => {
2556
2564
  writeSearchParams({ [BOARD_PARAM]: null });
2557
2565
  }, [writeSearchParams]);
2558
2566
  const presentSection = useCallback2(
2559
- (sectionId) => {
2560
- const firstBoardId = layout.sections.find((section) => section.id === sectionId)?.boardIds[0];
2567
+ (sectionId, startBoardId) => {
2568
+ const sectionBoardIds = layout.sections.find((section) => section.id === sectionId)?.boardIds ?? [];
2569
+ const firstBoardId = startBoardId && sectionBoardIds.includes(startBoardId) ? startBoardId : sectionBoardIds[0];
2561
2570
  if (!firstBoardId) return;
2562
2571
  setPresentSectionId(sectionId);
2563
2572
  openBoard(firstBoardId);