This Styles object can be accessed as the Canvas.styles parameter. Defining Styles for a CanvasĪ Canvas's Styles object will be created automatically when the Canvas is initialized. Of course, we can do this for the 3D styles as well to control the WebGL Canvases in a global manner. 6 ĬhemDoodle.DEFAULT_STYLES.bonds_saturationWidthAbs_2D = 2.6 ĬhemDoodle.DEFAULT_STYLES.bonds_hashSpacing_2D = 2.5 ĬhemDoodle.DEFAULT_STYLES.atoms_font_size_2D = 10 ĬhemDoodle.DEFAULT_STYLES.atoms_font_families_2D = ĬhemDoodle.DEFAULT_STYLES.atoms_displayTerminalCarbonLabels_2D = true ĬhemDoodle.DEFAULT_STYLES.atoms_useJMOLColors = true ĬhemDoodle.DEFAULT_STYLES.bondLength_2D = 14.4 ĬhemDoodle.DEFAULT_STYLES.bonds_width_2D =. Unless further overridden, as described in the following sections, all 2D Canvases will render their content with that definition. The following source code shows how to set the global styles to render all 2D Canvases in ACS Document 1996 style. To define styles globally, for an entire webpage, just set the style from the API for the ChemDoodle.DEFAULT_STYLES global variable. ![]() Styles can be set globally for the entire webpage, for each Canvas, or to precisely define graphics for each individual graphical object. In the ChemDoodle Web Components library, styles can be linked to more than just a Canvas. You may be wondering why this is useful, as this new object will not be linked to any graphics. You can also manually create an individual Styles object by calling its constructor as shown in the following code: ![]() A full list of the styles is described in the API. This way, you have full control over the graphics. All content rendered by the ChemDoodle Web Components library will have corresponding styles in the Styles object. These styles can be any type of data, from booleans to numbers to strings and arrays. ![]() This object contains a list of styles that will define how the Canvas will render its content. The Styles ObjectĪ Styles object is automatically created for each Canvas when it is initialized. This paradigm is true for both 2D and 3D canvases. Together they form a style sheet that can control your entire page in a global context, or finely control how a single atom or bond is drawn. Styles define how graphics in the ChemDoodle Web Components library are rendered.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |