-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
466 additions
and
49 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import * as React from "react" | ||
import * as ReactDOM from "react-dom" | ||
|
||
import Editor from "./editor"; | ||
import TopMenu from "./ui/top_menu"; | ||
|
||
type MyProps = {}; | ||
type MyState = { | ||
mode: string | ||
}; | ||
|
||
class App extends React.Component<MyProps, MyState> { | ||
private readonly _editor: Editor; | ||
|
||
constructor(props: MyProps) { | ||
super(props) | ||
|
||
this.state = { | ||
mode: 'Coronene' | ||
}; | ||
|
||
this._editor = new Editor(); | ||
|
||
this.onMenuItemClick = this.onMenuItemClick.bind(this); | ||
} | ||
|
||
public componentDidMount(): void { | ||
this._editor.init(); | ||
} | ||
|
||
public render(): React.ReactNode { | ||
return <div> | ||
<div> | ||
<TopMenu mode={this.state.mode} onItemClick={e => this.onMenuItemClick(e)} /> | ||
</div> | ||
<div id="draw-canvas" onMouseOver={e => this._editor.onMouseMove(e)}> | ||
|
||
<div id="svg-boundary" onMouseDown={e => this._editor.onMouseDown(e)} onMouseUp={e => this._editor.onMouseUp(e)} ></div> | ||
|
||
<p> | ||
<textarea id="mol2-data" name="text"></textarea> | ||
</p> | ||
<button id="draw-button" onClick={e => this._editor.onDrawClick()} >Draw</button> | ||
<button id="download-button" onClick={e => this._editor.onDownloadClick()}>Download as SVG</button> | ||
|
||
</div> | ||
</div> | ||
} | ||
|
||
private onMenuItemClick(itemName: string): void { | ||
this.setState({ | ||
mode: itemName | ||
}); | ||
} | ||
|
||
} | ||
|
||
ReactDOM.render( | ||
React.createElement(App), | ||
document.getElementById("react-app") | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import * as React from "react"; | ||
import { ReactNode } from "react"; | ||
import Button from '@material-ui/core/Button'; | ||
import ButtonGroup from '@material-ui/core/ButtonGroup'; | ||
|
||
type Props = { | ||
mode: string, | ||
onItemClick: ((itemName: string) => void) | ||
}; | ||
type State = {}; | ||
|
||
export default class TopMenu extends React.Component<Props, State> { | ||
constructor(props: Props) { | ||
super(props); | ||
|
||
this.state = {} | ||
} | ||
|
||
public render(): ReactNode { | ||
return <div className="top-menu"> | ||
<div> | ||
<ButtonGroup variant="outlined" color="primary" aria-label="outlined primary button group"> | ||
<Button onClick={() => this.props.onItemClick('Coronene')} disabled={this.props.mode == "Coronene"}> | ||
Coronene | ||
</Button> | ||
<Button onClick={() => this.props.onItemClick('Benzene')} disabled={this.props.mode == "Benzene"}> | ||
Benzene | ||
</Button> | ||
<Button onClick={() => this.props.onItemClick('Butadiene')} disabled={this.props.mode == "Butadiene"}> | ||
Butadiene | ||
</Button> | ||
</ButtonGroup> | ||
</div> | ||
</div> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters