Skip to content

Decouple TimeControl and TimeUi and refactor the codebase to be more modular#108

Open
sandesh-sp wants to merge 9 commits into
developmentfrom
feat/timeline-core
Open

Decouple TimeControl and TimeUi and refactor the codebase to be more modular#108
sandesh-sp wants to merge 9 commits into
developmentfrom
feat/timeline-core

Conversation

@sandesh-sp

@sandesh-sp sandesh-sp commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

This PR introduces architectural refactoring of the TimeControl system, decoupling it from TimeUI through event-based communication.

Key Changes

  • Decouple TimeControl and TimeUI - Eliminated circular dependency by introducing event-based communication via MMGIS Event Bus
  • Event-driven time management - TimeControl now emits time:change, time:setRequested, and time:layersReloaded events instead of direct method calls
  • Modern vs Legacy mode detection - TimeUI conditionally renders only in classic layout; modern layout uses Timeline tool

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved this function to tileUrlUtils.ts

@slesaad slesaad changed the base branch from development to improvement/title-plugin June 5, 2026 20:22
// Subscribe to user-initiated time changes from UI elements via Event Bus
// and emit controlReady event for UI elements to initialize
if (window.mmgisAPI) {
const cleanup = window.mmgisAPI.on('time:userChanged', ({ startTime, endTime, currentTime }) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why time:userChanged ? can it be just time:updated or something similar

Comment on lines +350 to +360
// TODO: Refactor this to push URL compilation and refreshing into the map engine adapters
// so that TimeControl.js doesn't need to check Map_.engine.engineType === 'deckgl'
// or rely on tileLayer.refresh().
if (tileLayer && typeof tileLayer.refresh === 'function') {
// Pass deckOptions to refresh so it updates this.options with new COG fields
tileLayer.refresh(resolvedUrl, true, deckOptions)
} else if (Map_.engine?.engineType === 'deckgl') {
const newUrl = compileTileUrl(resolvedUrl, deckOptions)
Map_.engine.updateLayer(layer.name, { url: newUrl })
return true
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either make an issue for this TODO or fix it in the PR

Base automatically changed from improvement/title-plugin to development June 9, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants