Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw molecule on specific canvas area using drawMolecule #124

Open
vdyma opened this issue Nov 4, 2021 · 3 comments
Open

Draw molecule on specific canvas area using drawMolecule #124

vdyma opened this issue Nov 4, 2021 · 3 comments

Comments

@vdyma
Copy link

vdyma commented Nov 4, 2021

We at Datagrok are using openchemlib for rendering molecules. It is a common task to render multiple molecules simultaneously, but currently it is necessary to use separate canvas element to be able to draw each molecule in a specific area of a larger canvas meaning excessive resources usage. It would be very useful to be able to draw a molecule in a specific canvas area when using drawMolecule by providing such parameters as xy coordinates of top left vertex of the area rectangle as well as its width and height.

@targos
Copy link
Member

targos commented Nov 5, 2021

It looks like something that could be supported, but it needs some thinking about how to expose it in the API.
This is where the drawing actually happens:

depictor.validateView(null, new Rectangle2D.Double(0, 0, (float) width, (float) height),
AbstractDepictor.cModeInflateToMaxAVBL);
ctx.clearRect(0, 0, width, height);
depictor.paint(ctx);

Would you like to look into it and propose something?

@vdyma
Copy link
Author

vdyma commented Nov 5, 2021

It seems the best if drawMolecule function had additional properties of the options parameter that would represent x and y coordinates of top left area vertex, its height and width. Another parameter clear could also prove useful to clear the specified area before drawing.

@StLeonidas
Copy link

@targos , this option remains significant. Are there any thoughts if it can or planned to be exposed to API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants