diff --git a/api/molecules-container-ligand-fitting.cc b/api/molecules-container-ligand-fitting.cc index 016653a46..b7e258283 100644 --- a/api/molecules-container-ligand-fitting.cc +++ b/api/molecules-container-ligand-fitting.cc @@ -546,7 +546,8 @@ molecules_container_t::get_svg_for_residue_type(int imol, const std::string &com } else { svg_molecule_t svg; svg.import_rdkit_mol(&mol, iconf); - s = svg.render_to_svg_string(dark_bg_flag); + double sf = 400.0; + s = svg.render_to_svg_string(sf, dark_bg_flag); ligand_svg_store[key] = s; } } else { @@ -577,7 +578,8 @@ molecules_container_t::get_svg_for_residue_type(int imol, const std::string &com svg_molecule_t svg; svg.import_rdkit_mol(&rdkit_mol, conformer_id); dark_bg_flag = false; - s = svg.render_to_svg_string(dark_bg_flag); + double sf = 400.0; + s = svg.render_to_svg_string(sf, dark_bg_flag); } ligand_svg_store[key] = s; } diff --git a/lidia-core/svg-container.hh b/lidia-core/svg-container.hh index 02678cd81..7deca53a2 100644 --- a/lidia-core/svg-container.hh +++ b/lidia-core/svg-container.hh @@ -1,3 +1,5 @@ +#ifndef COOT_LIDIA_CORE_SVG_CONTAINER_HH +#define COOT_LIDIA_CORE_SVG_CONTAINER_HH #include @@ -5,7 +7,7 @@ class svg_container_t { public: svg_container_t() { init(); } - svg_container_t(const std::string &s) : svg(s) { init(); } + explicit svg_container_t(const std::string &s) : svg(s) { init(); } std::string svg; std::string svg_header_1; std::string svg_header_2; @@ -36,8 +38,8 @@ public: void update_bounds(float min_xx, float min_yy, float max_xx, float max_yy) { if (min_xx < min_x) min_x = min_xx; if (min_yy < min_y) min_y = min_yy; - if (max_xx < max_x) max_x = max_xx; - if (max_yy < max_y) max_y = max_yy; + if (max_xx > max_x) max_x = max_xx; + if (max_yy > max_y) max_y = max_yy; } std::string make_viewbox_string() const { @@ -54,6 +56,11 @@ public: svg += s; } + void add(const svg_container_t &svgc_in) { + svg += svgc_in.svg; + update_bounds(svgc_in.min_x, svgc_in.min_y, svgc_in.max_x, svgc_in.max_y); + } + std::string compose() const { std::string s = svg_header_1; @@ -66,3 +73,6 @@ public: }; + + +#endif // SVG_COOT_LIDIA_CORE_CONTAINER_HH diff --git a/lidia-core/svg-molecule.cc b/lidia-core/svg-molecule.cc index dba7ebcd8..c34834c44 100644 --- a/lidia-core/svg-molecule.cc +++ b/lidia-core/svg-molecule.cc @@ -849,9 +849,10 @@ svg_atom_t::make_text_item(const lig_build::atom_id_info_t &atom_id_info, } std::string -svg_molecule_t::render_to_svg_string(bool dark_background_flag) { +svg_molecule_t::render_to_svg_string(double sf, bool dark_background_flag) { - svg_container_t s = make_svg(dark_background_flag); + // 20241002-PE note sf was 400.0; + svg_container_t s = make_svg(sf, dark_background_flag); return s.compose(); @@ -859,7 +860,7 @@ svg_molecule_t::render_to_svg_string(bool dark_background_flag) { svg_container_t -svg_molecule_t::make_svg(bool dark_background_flag) { +svg_molecule_t::make_svg(double sf, bool dark_background_flag) { auto make_bond_comment = [] (unsigned int bond_idx, const svg_bond_t &bond) { std::string s("