Skip to content

Night Toggle

The Night Toggle Plugin is a component of the KeepTrack application that provides functionality for switching between day and night textures when visualizing Earth.

Features

  • Toggle between day and night Earth textures
  • Accessible via bottom menu icon
  • Keyboard shortcut support
  • Integration with sound effects

User Interface

The plugin adds the following UI element:

  1. A “Night Toggle” icon in the bottom menu for quick access

Usage

Toggling Night Mode

  1. Click the “Night Toggle” icon in the bottom menu
  2. The Earth texture will switch between day and night views

Integration with KeepTrack

The Night Toggle Plugin integrates with several KeepTrack components:

  • InputManager: Registers keyboard events for toggling
  • SoundManager: Plays sound effects when toggling
  • WebGL Context: Manages texture binding for Earth visualization

Development

When extending or modifying the Night Toggle Plugin, consider the following:

  • The plugin follows the KeepTrackPlugin architecture
  • It registers a keyboard event handler for the ‘N’ key
  • The toggle state is managed through the isMenuButtonActive property

Code Configuration

The plugin supports the following configuration options:

  • bottomIconElementName: Set to ‘menu-day-night’
  • bottomIconLabel: Set to ‘Night Toggle’
  • bottomIconImg: Uses the imported dayNightPng image

Troubleshooting

  • If the toggle doesn’t seem to work, check the browser console for any error messages
  • Ensure that the required textures (day and night) are properly loaded in the WebGL context
  • Verify that the sound files for toggle effects are available and correctly referenced