@watergis/maplibre-gl-terradraw
    Preparing search index...

    Create a modal dialog for displaying titile, close button and content.

    Index

    Constructors

    Methods

    • Create a modal dialog content and return content element.

      Parameters

      • parentElement: HTMLElement

        parent element to append the dialog

      • addConttent: (contentElement: HTMLDivElement) => HTMLDivElement

        callback function to add content to the dialog. The callback receives a content element as an argument and must return the modified content element.

      Returns void

      HTMLDialogElement

      const dialog = new ModalDialog('my-dialog', 'My Dialog');
      dialog.create(document.body, (content) => {
      const p = document.createElement('p');
      p.textContent = 'This is my dialog content.';
      content.appendChild(p);
      return content;
      });
      dialog.open();
    • Create segment buttons element for the dialog.

      Parameters

      • options: { label: string; value: string }[]

        options for creating segment buttons

      • defaultValue: string

        default value for the segment buttons

      • onClick: (value: string) => void = ...

        a callback function to handle click events on the segment buttons

      Returns HTMLDivElement

      const segmentButtons = createSegmentButtons(
      [{ value: 'option1', label: 'Option 1' }, { value: 'option2', label: 'Option 2' }],
      'option1',
      (value) => console.log(`Selected: ${value}`)
      );
      document.body.appendChild(segmentButtons);