Only render connections to/from selected scene
@@ -158,7 +158,8 @@ class Connections extends Component {
scenesLookup,
actorsLookup,
triggersLookup,
- dragging
+ dragging,
+ selectedSceneId
} = this.props;
const connections = scenes.reduce((memo, scene) => {
@@ -167,6 +168,7 @@ class Connections extends Component {
const entity = actorsLookup[entityId];
const transitionEvents = scriptMapTransition(entity.script || []);
transitionEvents.forEach(event => {
+ if(scene.id === selectedSceneId || event.args.sceneId === selectedSceneId) {
const destScene = scenesLookup[event.args.sceneId];
if (destScene) {
memo.push(
@@ -184,6 +186,7 @@ class Connections extends Component {
})
);
}
+ }
});
});
@@ -192,6 +195,7 @@ class Connections extends Component {
const entity = triggersLookup[entityId];
const transitionEvents = scriptMapTransition(entity.script || []);
transitionEvents.forEach(event => {
+ if(scene.id === selectedSceneId || event.args.sceneId === selectedSceneId) {
const destScene = scenesLookup[event.args.sceneId];
if (destScene) {
memo.push(
@@ -209,12 +213,14 @@ class Connections extends Component {
})
);
}
+ }
});
});
// Scene Event Transitions
const sceneTransitionEvents = scriptMapTransition(scene.script || []);
sceneTransitionEvents.forEach(event => {
+ if(scene.id === selectedSceneId || event.args.sceneId === selectedSceneId) {
const destScene = scenesLookup[event.args.sceneId];
if (destScene) {
memo.push(
@@ -226,6 +232,7 @@ class Connections extends Component {
})
);
}
+ }
});
return memo;
}, []);
@@ -290,11 +297,13 @@ Connections.propTypes = {
dragPlayerStart: PropTypes.func.isRequired,
dragPlayerStop: PropTypes.func.isRequired,
dragDestinationStart: PropTypes.func.isRequired,
- dragDestinationStop: PropTypes.func.isRequired
+ dragDestinationStop: PropTypes.func.isRequired,
+ selectedSceneId: PropTypes.string
};
Connections.defaultProps = {
startScene: null,
+ selectedSceneId: null,
startX: 0,
startY: 0,
startDirection: "down"
@@ -311,6 +320,7 @@ function mapStateToProps(state) {
startY,
startDirection
} = state.entities.present.result.settings;
+ const { scene: selectedSceneId } = state.editor;
const startScene = scenesLookup[startSceneId] || scenes[0];
const { dragging } = state.editor;
return {
@@ -322,7 +332,8 @@ function mapStateToProps(state) {
startX,
startY,
startDirection,
- dragging: !!dragging
+ dragging: !!dragging,
+ selectedSceneId
};
}
