/** * The options for an action item for the contextual menu overlay. * * @typedef {Object} MenuActionOptions * @property {string} [cls] CSS class name(s) to use for the icon of the action item. * @property {string} [label] The label to display for the action item. If not defined, the name is used. * @property {string} name unique name for the menu action, which is used in the event fired when * the action is clicked. */ /** * The options for the contextual menu overlay. * * @typedef {Object} MenuOptions * @property {MenuActionOptions[]} actions A list of menu actions. * @property {boolean} [autoClose=true] Whether to automatically close the contextual menu when an action is * clicked or not. * @property {string} [title] A title to display as header of the contextual menu. */ /** * An OpenLayers overlay that shows a contextual menu with configurable actions * anchored from its top left to a specific location. An event is fired when * any of the action is clicked. * * @hidden */ export default class _default extends olOverlay { /** * @param {MenuOptions} [menuOptions] Menu options. * @param {import('ol/Overlay').Options} [options] Overlay options. */ constructor(menuOptions?: MenuOptions, options?: import("ol/Overlay").Options); /** * @type {import('ol/events').EventsKey[]} * @private */ private listenerKeys_; /** * @type {?import('ol/events').EventsKey} * @private */ private clickOutListenerKey_; /** * @type {boolean} * @private */ private autoClose_; /** * @type {JQuery[]} */ actions_: JQuery[]; /** * Opens the menu at the desited coordinate. Also starts listening for the * clickout if autoClose is enabled. * * @param {import('ol/coordinate').Coordinate} coordinate Where to open the menu. */ open(coordinate: import("ol/coordinate").Coordinate): void; /** */ close(): void; /** * @param {string} action The action name that was clicked. * @param {Event|import('ol/events/Event').default} evt Event. * @private */ private handleActionClick_; /** * Handles clicks out of the menu. If the menu is visible, close it. * * @param {Event|import('ol/events/Event').default} evt Event. * @private */ private handleClickOut_; /** * When the mouse is hovering the menu, set the event coordinate and pixel * values to Infinity to do as if the mouse had been move out of range of the * map. This prevents behaviors such as vertex still appearing while mouse * hovering edges of features bound to an active modify control while the * cursor is on top of the menu. * * @param {import('ol/MapBrowserEvent').default} myEvent Event. * @private */ private handleMapPointerMove_; } /** * The options for an action item for the contextual menu overlay. */ export type MenuActionOptions = { /** * CSS class name(s) to use for the icon of the action item. */ cls?: string; /** * The label to display for the action item. If not defined, the name is used. */ label?: string; /** * unique name for the menu action, which is used in the event fired when * the action is clicked. */ name: string; }; /** * The options for the contextual menu overlay. */ export type MenuOptions = { /** * A list of menu actions. */ actions: MenuActionOptions[]; /** * Whether to automatically close the contextual menu when an action is * clicked or not. */ autoClose?: boolean; /** * A title to display as header of the contextual menu. */ title?: string; }; import olOverlay from 'ol/Overlay';