draggableLineWithButtonComponent.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import * as React from "react";
  2. export interface IDraggableLineWithButtonComponent {
  3. data: string;
  4. tooltip: string;
  5. iconImage: any;
  6. onIconClick: (value: string) => void;
  7. iconTitle: string;
  8. }
  9. export class DraggableLineWithButtonComponent extends React.Component<IDraggableLineWithButtonComponent> {
  10. constructor(props: IDraggableLineWithButtonComponent) {
  11. super(props);
  12. }
  13. render() {
  14. return (
  15. <div className="draggableLine withButton"
  16. title={this.props.tooltip}
  17. draggable={true}
  18. onDragStart={event => {
  19. event.dataTransfer.setData("babylonjs-material-node", this.props.data);
  20. }}>
  21. {this.props.data.substr(0, this.props.data.length - 6)}
  22. <div className="icon" onClick={() => { this.props.onIconClick(this.props.data); }} title={this.props.iconTitle}>
  23. <img title={this.props.iconTitle} src={this.props.iconImage}/>
  24. </div>
  25. </div>
  26. );
  27. }
  28. }