function defaultOptions()

in packages/ketcher-core/src/application/render/options.ts [22:133]


function defaultOptions(renderOptions: RenderOptions): RenderOptions {
  const options = getOptionsWithConvertedUnits(renderOptions);

  const scaleFactorMicro = options.microModeScale || 100;
  const scaleFactorMacro = options.macroModeScale || 200;

  if (options.rotationStep) {
    utils.setFracAngle(options.rotationStep);
  }

  const labelFontSize = Math.ceil(1.9 * (scaleFactorMicro / 6));
  const subFontSize = Math.ceil(0.5 * labelFontSize);

  const defaultOptions: Partial<RenderOptions> = {
    'dearomatize-on-load': false,
    ignoreChiralFlag: false,
    disableQueryElements: null,
    // flags for debugging
    showAtomIds: false,
    showBondIds: false,
    showHalfBondIds: false,
    showLoopIds: false,
    // rendering customization flags
    // TODO: hide enhanced flags opts
    showValenceWarnings: true,
    autoScale: false, // scale structure to fit into the given view box, used in view mode
    autoScaleMargin: 0,
    maxBondLength: 0, // 0 stands for "not specified"
    atomColoring: true,
    hideImplicitHydrogen: false,
    hideTerminalLabels: false,
    // atoms
    carbonExplicitly: false,
    showCharge: true,
    showHydrogenLabels: ShowHydrogenLabels.TerminalAndHetero,
    showValence: true,
    // bonds
    aromaticCircle: true,

    microModeScale: scaleFactorMicro,
    macroModeScale: scaleFactorMacro,
    zoom: 1.0,
    offset: new Vec2(),

    lineWidth: scaleFactorMicro / 20,
    bondSpace: options.bondSpacingInPx || scaleFactorMicro / 7,
    stereoBond: options.stereoBondWidthInPx || scaleFactorMicro / 7,
    subFontSize: options.fontszsubInPx || subFontSize,
    font: '30px Arial',
    fontszInPx: options.fontszInPx || labelFontSize,
    fontszsubInPx: options.fontszsubInPx || subFontSize,
    fontRLabel: (options.fontszInPx || labelFontSize) * 1.2,
    fontRLogic: (options.fontszInPx || labelFontSize) * 0.7,

    radiusScaleFactor: 0.38,

    /* styles */
    lineattr: {
      stroke: '#000',
      'stroke-width': options.bondThicknessInPx || scaleFactorMicro / 20,
      'stroke-linecap': 'round',
      'stroke-linejoin': 'round',
    },
    arrowSnappingStyle: {
      fill: '#365CFF',
      stroke: '#365CFF',
    },
    bondSnappingStyle: {
      fill: '#365CFF',
      stroke: '#365CFF',
      'stroke-width': options.bondThicknessInPx * 1.5,
    },
    /* eslint-enable quote-props */
    selectionStyle: {
      fill: '#57FF8F',
      stroke: '#57FF8F',
    },
    hoverStyle: {
      stroke: '#0097A8',
      fill: '#CCFFDD',
      'stroke-width': (0.6 * scaleFactorMicro) / 20,
    },
    innerHoverStyle: {
      stroke: '#CCFFDD',
      fill: 'none',
      'stroke-width': (4.6 * scaleFactorMicro) / 20,
    },
    sgroupBracketStyle: {
      stroke: 'darkgray',
      'stroke-width': (0.5 * scaleFactorMicro) / 20,
    },
    lassoStyle: {
      stroke: 'gray',
      'stroke-width': '1px',
    },
    selectionStyleSimpleObject: {
      stroke: '#57FF8F',
      'stroke-width': scaleFactorMicro / 4,
      'stroke-linecap': 'round',
    },
    movingStyle: {
      cursor: 'all-scroll',
    },
    atomSelectionPlateRadius: options.fontszInPx || labelFontSize,
    contractedFunctionalGroupSize: 50,

    previewOpacity: 0.5,
    viewOnlyMode: false,
  };

  return Object.assign({}, defaultOptions, options);
}