Giter Site home page Giter Site logo

zakodium-oss / react-ocl Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 2.0 36.26 MB

React components integrating OpenChemLib

Home Page: https://zakodium-oss.github.io/react-ocl

License: MIT License

JavaScript 100.00%
molfile smiles reactjs molecule editor hacktoberfest

react-ocl's People

Contributors

hamed-musallam avatar lpatiny avatar sebastien-ahkrin avatar stropitek avatar targos avatar zakodium-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-ocl's Issues

StructureEditor never updates when you change initialMolfile or initialIDCode programmatically

I created a wrapper that uses some code changes for an initial data structure. I wanted to update the molFile (or IDCode) and expected that once I updated the value - it automatically re-render the component (and structures), but this never happened. It seems like once you set the initial<something> it'd never be changed.

I checked the source code but don't see any solutions on how to approach that.

Thoughts?

weird color change

Seems the color of the SVG is different from expected. This is in particular shocking in the case of stereo bond. You select a 'abs' (red kind) and it becomes blue.

Seems blue and red are inverted

2022-08-15 12 27 06

Change molecule in existing editor

There is the property initialMolfile that allows to set the molecule when creating the component.

I would need the possibility to change the molecule once the component has been loaded.

Is this possible ? If not it would be a nice feature to have.

No way to edit atoms on Safari iOs ?

I have no problems to add polycycles but trying to change an atom fails. It looks like it adds systematically an atom rather that replace the existing one.

It would be great to have a link to test the future version and check if this issue is solved.

babelrc bug?

{
  "presets": ["react"],
  "env": {
    "es6": {
      "presets": [
        ["env", {"modules": false}]
      ]
    },
    "development": {
      "presets": [
        "env"
      ]
    }
  }
}

how do we deal with errors?

When a value is incorrect, such as a non-parseable SMILES. Throw? Warn and show some message?
We should check if there are existing recommendations.

Add arrows

Currently it is possible in the SvgRenderer to highlight some bonds and atoms.

Internally it use 'useHighlight' in order to change the style.

We would need the possibility to annotate the molecule using 'arrows'.

This means:

  • SvgRenderer (and also SmilesSvgRenderer, IdcodeSvgRenderer and MolfileSvgRenderer) should allow a new property 'arrows'
  • arrows is an array of object that contains 'atom1', 'atom2' and svg 'style' property (allows to change color, thickness, from, to), 'kind' (either a straight 'line' or 'curved' (an arc) , default 'line')

The coordinates of the center of the atoms can be found by searching the resulting SVG for the corresponding id and searching the cx and cy properties like in :

Once you have based on atom1 and atom2 the from / to of the arraw you should add it in the renderer

New properties in the storybook should be added in order to debug / test this new feature.

NB: Many arrows can be added at the same time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.