angular 代码:
async createImage(e) {
console.log(this.smilesDiv.nativeElement);
console.log(this.smartsDiv.nativeElement);
await e.marvinSketcherInstance.importStructure(null, this.rule_expr_str).catch(function (error) {
console.log(error);
});
let mrv = await e.marvinSketcherInstance.exportStructure('mrv');
const fragment = this.neutral;
mrv = await this.formatImg(mrv, this.arrowtype, fragment, true);
const image$ = e.createImage('image/jpeg', 700, 200);
image$
.render(mrv)
.then((res) => {
this.smilesDiv.nativeElement.src = res;
this.cdf.detectChanges();
})
.catch((res) => {
this.cdf.detectChanges();
});
await e.marvinSketcherInstance.importStructure(null, this.rule_expr).catch(function (error) {
console.log(error);
});
let mrv1 = await e.marvinSketcherInstance.exportStructure('mrv');
const fragment1 = this.neutral;
mrv1 = await this.formatImg(mrv1, this.arrowtype, fragment1, true, 'aromatize');
const image1$ = e.createImage('image/jpeg', 700, 200);
image1$
.render(mrv1)
.then((res) => {
this.smartsDiv.nativeElement.src = res;
this.cdf.detectChanges();
})
.catch((res) => {
this.cdf.detectChanges();
});
}