Skip to content
Docs version
@hungpvq/vue-map@1.1.0@hungpvq/vue-map-core@1.1.0@hungpvq/vue-map-dataset@1.1.0@hungpvq/vue-map-draw@1.1.0@hungpvq/map-draw@1.1.0@hungpvq/react-map@1.1.0@hungpvq/react-map-core@1.1.0@hungpvq/react-map-dataset@1.1.0@hungpvq/react-map-draw@1.1.0

UniversalRegistry — map controls

Mounted ModuleContainer controls (popup, sidebar, float, and button-only) register themselves via UniversalRegistry.registerControl. The class lives in @hungpvq/map-core (bags on @hungpvq/shared-store); Vue / React adapters extend it with typed component registration only. Methods, menu handlers, components, and control handles share one store and one resolve path (runMapControlAction included).

Reserved global method keys MAP_PLATFORM_REGISTRY_METHOD.* (__platform.getMap, __platform.subscribeMapReady, __platform.registerStoreCleanup) wire map accessors — they are not app controls and survive clearMap.

Menu / UI components (registerComponent / registerComponentForMap): UniversalRegistry components.

ts
import { UniversalRegistry, runMapControlAction } from '@hungpvq/map-core';
// or `@hungpvq/vue-map-core` / `@hungpvq/react-map-core`

UniversalRegistry.openControl(mapId, 'mapLayerControl');
runMapControlAction(mapId, 'mapHomeControl');

List & inspect

ts
import { UniversalRegistry } from '@hungpvq/vue-map-core';
// or `@hungpvq/react-map-core`

const controls = UniversalRegistry.listControls(mapId);
// [{ id, panelKind, title, props, actions, open, close, runAction, ... }]

UniversalRegistry.getControl('mapLayerControl', mapId)?.props;
UniversalRegistry.getKeysForMap(mapId, 'control');

Open / close / move panel

ts
UniversalRegistry.openControl(mapId, 'mapLayerControl');
UniversalRegistry.closeControl(mapId, 'mapGotoControl');

// Popup / float offsets (pixels from edges)
UniversalRegistry.setControlPosition(mapId, 'mapGotoControl', {
  top: 80,
  right: 60,
});

// Sidebar dock
UniversalRegistry.setControlPosition(mapId, 'mapLayerControl', {
  location: 'right',
});

Run button actions

Single-button controls (Home, Fullscreen, Layer toggle, …):

ts
UniversalRegistry.runControlAction(mapId, 'mapHomeControl');
// or
UniversalRegistry.runControlAction(mapId, 'mapLayerControl', 'mapLayerControl');

Multi-button controls — pass type, or omit it to use defaultActionType:

ts
// Uses defaultActionType ('distance' / 'mapZoomIn' / 'mapPrintShow')
UniversalRegistry.runControlAction(mapId, 'mapMeasurementControl');
UniversalRegistry.runControlAction(mapId, 'mapNavigationControl');
UniversalRegistry.runControlAction(mapId, 'mapPrintAdvancedControl');

// Or pass type explicitly
UniversalRegistry.runControlAction(mapId, 'mapNavigationControl', 'mapZoomIn');
UniversalRegistry.runControlAction(mapId, 'mapNavigationControl', 'mapZoomOut');
UniversalRegistry.runControlAction(mapId, 'mapNavigationControl', 'mapCompass');
UniversalRegistry.runControlAction(mapId, 'mapMeasurementControl', 'distance');
UniversalRegistry.runControlAction(mapId, 'mapMeasurementControl', 'setting');
UniversalRegistry.runControlAction(mapId, 'mapPrintAdvancedControl', 'mapPrintShow');
UniversalRegistry.runControlAction(mapId, 'mapPrintAdvancedControl', 'mapPrintSetting');

Inspect available action types:

ts
const ctrl = UniversalRegistry.getControl('mapNavigationControl', mapId);
ctrl?.actions.map((a) => a.type); // ['mapCompass', 'mapZoomIn', 'mapZoomOut']

Control ids (common)

idKindNotes
mapLayerControlsidebar
mapDatasetControlsidebar
mapGotoControlpopup
mapSettingControlpopup
mapInfoControlpopup
mapWorkerControlsidebarAny registered web worker
mapIdentifyControlpopup
mapCrsControlpopup
mapLegendControlpopup
mapBaseMapControlpopup
mapEventManagementControlsidebar
mapHomeControlbutton
mapFullscreenControlbutton
mapThemeControlbuttonToggle light/dark; hover menu for themes
mapGeoLocateControlbutton
mapGlobeControlbutton
mapPrintControlbutton
mapNavigationControlbuttonmulti: mapCompass, mapZoomIn, mapZoomOut
mapMeasurementControlbuttonmulti: distance, area, …
mapPrintAdvancedControlbuttonmulti: mapPrintShow, mapPrintSave, …
mapInspectControlbuttonDraw packages (Vue + React); Inspect docs under /map/draw/#inspect
mapDrawDraftListpopupDraw draft list when draft mode is on
mapRegistryControlpopupInspector for registered controls

Ids match toolbar / module ids where those exist.

Dynamic panels (mapCreateControl, mapAttributeTable, mapLayerDetail, mapDatasetDetail, mapMeasurementSetting, …) register when opened via UI / ComponentManagementControl.

Demo

Mount RegistryControl (id mapRegistryControl) — or open #/registry-control in apps/vue/demo-map / apps/react/demo-map.

The inspector uses ModuleContainer + DraggableItemPopup + useRegisterMapControl, same as other library controls.

Hook (library authors)

Canonical pattern — setShow must accept a boolean (true / false). openControl / closeControl call setShow(true|false); do not pass a toggle-only function.

ts
const [show, setShow] = useShow(props.show);

useRegisterMapControl(mapId, {
  id: 'mapLayerControl',
  panelKind: 'sidebar', // or 'popup' | 'float' | 'button'
  title: () => 'Layers',
  show,
  setShow,
  // Multi-action controls: declare default for runAction() without type
  // defaultActionType: 'distance',
  actions: [{ type: 'mapLayerControl', run: () => setShow() }],
});

App usage (same for every demo / page):

ts
UniversalRegistry.openControl(mapId, 'mapLayerControl');
UniversalRegistry.closeControl(mapId, 'mapLayerControl');
UniversalRegistry.setControlPosition(mapId, 'mapLayerControl', {
  location: 'right',
});
UniversalRegistry.runControlAction(mapId, 'mapLayerControl');

Sidebar panels sync visibility through the draggable store; setShow(false) must clear that store entry (handled inside DraggableItemSideBar / useInitSidebar).