UNPKG

bimplus-renderer

Version:

bim+ renderer

38 lines (31 loc) 1.17 kB
# Moment Timezone Integration The `setSunPosition` function now supports optional moment-timezone integration. Here are the different ways to use it: ## Inject programmatically ```javascript import { injectMomentTimezone, hasMomentTimezone } from 'bimplus-renderer'; // If you have moment-timezone available in your application import moment from 'moment-timezone'; // You can check if moment-timezone is available before calling the function: if (!hasMomentTimezone()) { console.log('Injecting moment-timezone for sun positioning features'); injectMomentTimezone(moment); } // Now you can use setSunPosition viewport3D.setSunPosition({ northDirection: 0, year: 2024, month: 6, day: 21, hours: 12, minutes: 0, timezone: 'Europe/Berlin', latitude: 52.5200, longitude: 13.4050, showSky: true }); ``` This approach allows: - Backward compatibility for existing users who have moment-timezone - Forward compatibility for new users who don't want the dependency - Clear error messages when the functionality is used without the required library - Flexibility in how the library is provided (npm, CDN, injection)