Commit bd29be25 authored by Marco Sehrer's avatar Marco Sehrer
Browse files

Merge pull request #221 from ninjaconcept/ms-fix-reaction-svg-style

fix reaction svg style and update behavior
parents 8a4aa491 6ce90229
......@@ -53,28 +53,29 @@ export default class ElementsTableEntries extends Component {
previewColumn(element) {
const {ui} = this.props;
const classNames = classnames({
const classNames = classnames(
{
'molecule': element.type == 'sample'
}, {
},
{
'reaction': element.type == 'reaction'
},
{
'molecule-selected': element.type == 'sample' && this.isElementSelected(element)
}, {
'reaction-selected': element.type == 'reaction' && this.isElementSelected(element)
});
let svgContainer = {
},
{
'reaction-selected': element.type == 'reaction' && this.isElementSelected(element)
}
);
let svgContainerStyle = {
verticalAlign: 'middle',
textAlign: 'center'
};
if(element.type == 'reaction') {
svgContainer = {
width: '50%',
position: 'relative',
padding: 0,
paddingBottom: '10%'
};
}
if(ui.showPreviews && (element.type == 'sample' || element.type == 'reaction')) {
return (
<td style={svgContainer}>
<td style={svgContainerStyle}>
<SVG src={element.svgPath} className={classNames} key={element.id}/>
</td>
);
......
......@@ -35,6 +35,12 @@
fill: white;
}
.reaction svg {
height: 90px;
margin-left: 10px;
}
.reaction-selected line, .reaction-selected text, .reaction-selected polygon {
stroke: white;
fill: white;
......
......@@ -16,7 +16,7 @@ module SVG
@template = <<-END
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cml="http://www.xml-cml.org/schema"
width="#{width}" height="100" viewBox="0 0 #{width} 100" style="position: absolute;height: 100%;max-height: 200px;width: 100%;top: 0;left: 0;">
width="#{2*width}px" height="200px" viewBox="0 0 #{width} 100">
<title>Reaction 1</title>
END
@labels = <<-END
......@@ -46,7 +46,7 @@ module SVG
end
def compose_reaction_svg
@template + sections.values.join + "</svg>"
@template.strip + sections.values.flatten.map(&:strip).join + "</svg>"
end
def file_path
......@@ -94,7 +94,8 @@ module SVG
def generate_filename
inchikeys = {:starting_materials => @starting_materials, :reactants => @reactants, :products => @products}
hash_of_inchikeys = Digest::SHA256.hexdigest((inchikeys.values + [@label]).join)
key_base = "#{inchikeys.to_a.flatten.join}#{@label}"
hash_of_inchikeys = Digest::SHA256.hexdigest(key_base)
hash_of_inchikeys + '.svg'
end
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment