An extension for Mappedin JS that manages the visibility of floors and facades on camera change.
With NPM:
npm install @mappedin/dynamic-focus
With Yarn:
yarn add @mappedin/dynamic-focus
import { show3dMap } from '@mappedin/mappedin-js';
import { DynamicFocus } from `@mappedin/dynamic-focus`;
const mapView = await show3dMap(...);
/**
* Create a new Dynamic Focus controller that automatically updates the MapView scene.
*/
const df = new DynamicFocus(mapView, { autoFocus: true, setFloorOnFocus: true });
/**
* Disable automatic updates - now you'll need to manually call `focus()` to update the view.
*/
df.updateState({ autoFocus: false });
/**
* Manually trigger a focus update to show/hide facades and update floor visibility.
*/
df.focus();
/**
* Clean up the controller and restore default floor visibility behavior
*/
df.destroy();