UNPKG

@projectstorm/react-diagrams-defaults

Version:
22 lines 1.1 kB
import * as React from 'react'; export class DefaultLinkSegmentWidget extends React.Component { render() { const Bottom = React.cloneElement(this.props.factory.generateLinkSegment(this.props.link, this.props.selected || this.props.link.isSelected(), this.props.path), { ref: this.props.forwardRef }); const Top = React.cloneElement(Bottom, Object.assign(Object.assign({ strokeLinecap: 'round', onMouseLeave: () => { this.props.onSelection(false); }, onMouseEnter: () => { this.props.onSelection(true); } }, this.props.extras), { ref: null, 'data-linkid': this.props.link.getID(), strokeOpacity: this.props.selected ? 0.1 : 0, strokeWidth: 20, fill: 'none', onContextMenu: () => { if (!this.props.link.isLocked()) { event.preventDefault(); this.props.link.remove(); } } })); return (React.createElement("g", null, Bottom, Top)); } } //# sourceMappingURL=DefaultLinkSegmentWidget.js.map