new PhotoDirHandler( photoFldDn [, photoDirDn [, photoCardDn [, secondary ] ] ] )

Handles photo direction field synchronization

Description

Synchronizes photo direction fields between degrees and cardinal directions. Automatically populates direction fields from photo metadata and keeps degree/cardinal fields in sync.

Parameters
Name Type Attributes Default Description
photoFldDn string

Photo field data name

photoDirDn string <optional>
""

Direction field data name (degrees)

photoCardDn string <optional>
""

Cardinal direction field data name

secondary boolean <optional>
false

Use 16-point compass if true, 8-point if false

Properties
Name Type Description
photoDn string

Photo field data name

dnDir string

Direction field data name (degrees 0-360)

dnCard string

Cardinal direction field data name (N, NE, E, etc.)

secondary boolean

Use 16-point compass if true, 8-point if false

Examples
// Create handler
const photoDirObj = new PhotoDirHandler('site_photos', 'photo_direction_deg', 'photo_direction_card', false);

// Set up event handlers
function changeDir(event) {
  photoDirObj.popOther(event);
}
ON('change', 'photo_direction_deg', changeDir);
ON('change', 'photo_direction_card', changeDir);
ON('add-photo', 'site_photos', photoDirObj.extractPhotoDir.bind(photoDirObj));
// Using factory method (backward compatible)
const photoDirObj = M.photoDirHandler('site_photos', 'photo_direction_deg', 'photo_direction_card');

Methods


popOther( event )

Description

When one field changes, updates the other to match. Converts between degrees (0-360) and cardinal directions (N, NE, E, etc.)

Parameters
Name Type Description
event Object

Fulcrum change event


extractPhotoDir( event )

Description

Automatically populates direction fields when a photo with direction metadata is added.

Parameters
Name Type Description
event Object

Fulcrum add-photo event