Prevent creating actors & seeing hover details on tiles outside of scenes
@@ -33,7 +33,16 @@ class Scene extends Component {
}
onMouseMove = e => {
- const { id, tool, editor, scene, showCollisions, zoomRatio } = this.props;
+ const {
+ id,
+ tool,
+ editor,
+ scene,
+ showCollisions,
+ zoomRatio,
+ width,
+ height
+ } = this.props;
const { creating, downX, downY } = this.state;
const pos = getCoords(e.currentTarget);
@@ -77,12 +86,14 @@ class Scene extends Component {
let actor = this.actorAt(tX, tY);
+ if (tX >= 0 && tY >= 0 && tX < width && tY < height) {
this.setStatus({
sceneName: scene.name,
x: tX,
y: tY,
actor:
- actor && (actor.name || "Actor " + (scene.actors.indexOf(actor) + 1))
+ actor &&
+ (actor.name || "Actor " + (scene.actors.indexOf(actor) + 1))
});
this.setState({
@@ -90,6 +101,7 @@ class Scene extends Component {
hoverX: tX,
hoverY: tY
});
+ }
this.lastTX = tX;
this.lastTY = tY;
