Fix right click on background not coming through (fix #13)

This commit is contained in:
futpib 2019-10-30 13:30:18 +03:00
parent ea33f8782d
commit dd7d64b725
2 changed files with 8 additions and 19 deletions

View File

@ -28,9 +28,6 @@ class GraphView extends GraphViewBase {
}
Object.assign(this, {
_super_renderBackground: this.renderBackground,
renderBackground: this.constructor.prototype.renderBackground.bind(this),
_super_handleZoomStart: this.handleZoomStart,
handleZoomStart: this.constructor.prototype.handleZoomStart.bind(this),
_super_handleZoomEnd: this.handleZoomEnd,
@ -146,19 +143,6 @@ class GraphView extends GraphViewBase {
return super.getMouseCoordinates();
}
renderBackground() {
const { gridSize, backgroundFillId, renderBackground, onBackgroundMouseDown } = this.props;
if (renderBackground) {
return renderBackground({
gridSize,
backgroundFillId,
onMouseDown: onBackgroundMouseDown,
});
}
return this._super_renderBackground();
}
getNodeComponent(id, node) {
const { nodeTypes, nodeSubtypes, nodeSize, renderNode, renderNodeText, nodeKey } = this.props;
return r(Node, {

View File

@ -756,6 +756,7 @@ class Graph extends React.PureComponent {
this._requestedIcons = new Set();
Object.assign(this, {
renderBackground: this.renderBackground.bind(this),
onBackgroundMouseDown: this.onBackgroundMouseDown.bind(this),
onZoomStart: this.onZoomStart.bind(this),
@ -1443,6 +1444,12 @@ class Graph extends React.PureComponent {
this.props.loadModule('module-null-sink', '');
}
renderBackground() {
return renderBackground({
onMouseDown: this.onBackgroundMouseDown,
});
}
render() {
const { nodes, edges } = this.state;
@ -1482,8 +1489,6 @@ class Graph extends React.PureComponent {
nodeSubtypes: {},
edgeTypes: {},
onBackgroundMouseDown: this.onBackgroundMouseDown,
onZoomStart: this.onZoomStart,
onZoomEnd: this.onZoomEnd,
@ -1508,7 +1513,7 @@ class Graph extends React.PureComponent {
layoutEngine,
renderBackground,
renderBackground: this.renderBackground,
renderDefs,