dsehnal / LiteMol

A library/plugin for handling 3D structural molecular data (not only) in the browser.
Other
157 stars 38 forks source link

bootstrap 5 - layout problem #74

Open hegelab opened 2 years ago

hegelab commented 2 years ago

Hi,

If I use bootstrap 5 then litemol plugin's div covers the full screen.

<div class="col-6">somthing</div>
<div class="col-6"><div id="litemol"</div></div>

Do you have any solution? Thanks, Tamas

dsehnal commented 2 years ago

Hi, I am pretty sure you can tweak the CSS of the litemol element to fit inline. Also, when you create the instance of the plugin, do you set the expanded property to true or false?

hegelab commented 2 years ago

I tried to have <span> instead of <div>and also tried to set class=d-inline- did not work

I do not see expanded property in create: https://webchemdev.ncbr.muni.cz/LiteMol/SourceDocs/interfaces/litemol.plugin.plugincontrolleroptions.html I found layoutState : {isExpanded} I tried all variations, including:

let plugin = LiteMol.Plugin.create({
        target: '#litemol',
        viewportBackground: '#ffffff',
        layoutState: { hideControls: true, expanded: false }
    });
dsehnal commented 2 years ago

Sorry the property is called isExpanded indeed.

LiteMol.Plugin.create({
        target: '#litemol',
        viewportBackground: '#ffffff',
        layoutState: { hideControls: true, isExpanded: false }
    });

It's same usage as for example in https://github.com/dsehnal/LiteMol/blob/2ce0190a9b369841c1c3ee7322c2f5dda3e7800e/examples/Transforms/src/App.ts#L12

You can also try:

<div class="col-6" style="position: relative"><div id="litemol"></div></div>

The lack of relative position on the parent is probably what's causing your issue.

hegelab commented 2 years ago

style="position: relative" solved this issue. Thanks a lot!