diff --git a/simgear/canvas/elements/CanvasMap.cxx b/simgear/canvas/elements/CanvasMap.cxx index 35763198..866954ac 100644 --- a/simgear/canvas/elements/CanvasMap.cxx +++ b/simgear/canvas/elements/CanvasMap.cxx @@ -199,10 +199,18 @@ namespace canvas _projection = std::make_shared(); _projection->setWorldPosition(_node->getDoubleValue(REF_LAT), - _node->getDoubleValue(REF_LON) ); - _projection->setOrientation(_node->getFloatValue(HDG)); - _projection->setScreenRange(_node->getDoubleValue(SCREEN_RANGE)); - _projection->setRange(_node->getDoubleValue(RANGE)); + _node->getDoubleValue(REF_LON)); + + // Only set existing properties to prevent using 0 instead of default values + + if( auto heading = _node->getChild(HDG) ) + _projection->setOrientation(heading->getFloatValue()); + + if( auto screen_range = _node->getChild(SCREEN_RANGE) ) + _projection->setScreenRange(screen_range->getDoubleValue()); + + if( auto range = _node->getChild(RANGE) ) + _projection->setRange(range->getDoubleValue()); _projection_dirty = true; }