partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
250 stars 61 forks source link

set the inital screensize #216

Closed sowiso closed 3 years ago

sowiso commented 3 years ago

Is there a way to set the inital screen size of the composer to something else than the default value?

partridgejiang commented 3 years ago

Hi @sowiso, you can simply use the CSS to control the size of composer (and other widgets), e.g.:

#myComposer
{
  width: 800px;
  height: 600px;
}

In JavaScript, the setDimension method can be used as well:

composer.setDimension('800px', '600px');
sowiso commented 3 years ago

Hi @partridgejiang Thanks for your answer. I actually was aware of this, but was not clear enough on my question. I meant the size of the Chemical Document, the one inside the editor.

image

partridgejiang commented 3 years ago

Hi @sowiso, you can change the default size of chem document by the config object of editor:

composer.getEditorConfigs().getChemSpaceConfigs().setDefScreenSize2D({x: 600, y: 400});
composer.newDoc();

Or using the changeChemSpaceScreenSize method to modify the screen size of an opened document:

composer.getEditor().changeChemSpaceScreenSize({x: 600, y: 400});
sowiso commented 3 years ago

Awesome, thanks!