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, { Object.assign(this, {
_super_renderBackground: this.renderBackground,
renderBackground: this.constructor.prototype.renderBackground.bind(this),
_super_handleZoomStart: this.handleZoomStart, _super_handleZoomStart: this.handleZoomStart,
handleZoomStart: this.constructor.prototype.handleZoomStart.bind(this), handleZoomStart: this.constructor.prototype.handleZoomStart.bind(this),
_super_handleZoomEnd: this.handleZoomEnd, _super_handleZoomEnd: this.handleZoomEnd,
@ -146,19 +143,6 @@ class GraphView extends GraphViewBase {
return super.getMouseCoordinates(); 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) { getNodeComponent(id, node) {
const { nodeTypes, nodeSubtypes, nodeSize, renderNode, renderNodeText, nodeKey } = this.props; const { nodeTypes, nodeSubtypes, nodeSize, renderNode, renderNodeText, nodeKey } = this.props;
return r(Node, { return r(Node, {

View File

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