Closed robotoer closed 4 years ago
Hi @robotoer, the editor widget provides a scrollClientToObject
method itself. In the resize observer callback, you can call it directly:
let editor = this.widget.getEditor(); // suppose this.widget is a composer
editor.scrollClientToObject(editor.getChemObj().getChildren()); // centers the current loaded molecules (childen of chemDocument)
Awesome! Thanks @partridgejiang
I have been trying to find a way to disable the current vertical/horizontal scrolling in the composer widget. I have tried setting the size of any loaded chemdocuments using a ResizeObserver which does prevent scrolling (by shrinking the document to fit the editor minus toolbars):
This unfortunately causes molecules to shift off the document boundaries occasionally (e.g. resizing the window, viewing same chemDocument on computers with different sized windows). Is there an easy way to center molecules within a chemDocument?
I really appreciate all the quick help you have been providing! Keep up the great work