Moving structures in editor

User bc4a467bb6

19-11-2014 12:35:23

Hello,


I'm trying to use Marvin JS to load several structures within the editor. I do this based on the example show here. However after a structure is successfully imported, the other ones are placed on top of the previous ones.


Is it possible to move the structures via JavaScript after they have been imported or change the location they will be imported to? Or maybe even append them in some way? Thanks in advance for the help! :-)

ChemAxon 7c2d26e5cf

24-11-2014 14:13:55

The Marvin JS API provides two ways to import structure:


- importStructure: clear the canvas and load the given structure


- pasteStructure: preserve the current content of the canvas and place the given structure into the center, the imported structure displays as selected to be able to drag the appropriate place.


The following example demonstrates both functionalities: Demo


As I see, the pasteStructure is closer to your request.


The Marvin JS API does not provide any function to modify coordinates automatically.


If you would like to render more structure to the same canvas, I recommend to merge these structures into a single molecule file and import this into the editor.


I assume the ChemAxon JChem WS is capable to merge more structures into a single one. I recommend to consult with the JChem WS team how to do it.

User bc4a467bb6

24-11-2014 14:24:04

Hello Tamas,


Thank you for your response. Yes, pasteStructure is what I've been working with. In the current situation, merging molecule files is unfortunalty not possible.


I'll follow your advise and see if JChem WS is more suitable. Thanks again!

User 870ab5b546

29-11-2014 19:24:54

In MarvinSketch, if there is already a structure on the canvas, then to paste a new structure onto the canvas, one must press the Paste button, then click on the canvas, and the new structure is centered on the click position.


By contrast, in MarvinJS, pressing command-V results in the new structure immediately appearing in the center of the canvas, and one then has to drag it off to the side to move it.


Is there any reason the MarvinSketch behavior can't be implemented in MarvinJS?

ChemAxon f052bdfe3c

05-12-2014 14:58:23

Yes. We have investigated both way at the beginning, and it was a technical decision. Not only place the structure to the canvas, but allow the user to place it directly. Besides, there are devices when we were not able to support the direct visual feedback on the cursor.


Best regards,


Efi