From a91f2c6d39028c46a2e07d8a870ae69d2a7fe748 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Fri, 22 May 2020 23:55:50 +1000 Subject: [PATCH] Added tap events for map interaction --- src/components/map/MapDrawing.js | 1 + src/components/map/MapFog.js | 1 + src/components/map/MapToken.js | 1 + 3 files changed, 3 insertions(+) diff --git a/src/components/map/MapDrawing.js b/src/components/map/MapDrawing.js index 8f446f8..b4ab726 100644 --- a/src/components/map/MapDrawing.js +++ b/src/components/map/MapDrawing.js @@ -191,6 +191,7 @@ function MapDrawing({ onMouseOver: (e) => handleShapeMouseOver(e, shape), onMouseOut: (e) => handleShapeMouseOut(e, shape), onClick: (e) => handleShapeClick(e, shape), + onTap: (e) => handleShapeClick(e, shape), fill: colors[shape.color] || shape.color, opacity: shape.blend ? 0.5 : 1, }; diff --git a/src/components/map/MapFog.js b/src/components/map/MapFog.js index f0dd0f3..6ef7a8a 100644 --- a/src/components/map/MapFog.js +++ b/src/components/map/MapFog.js @@ -187,6 +187,7 @@ function MapFog({ onMouseOver={(e) => handleShapeMouseOver(e, shape)} onMouseOut={(e) => handleShapeMouseOut(e, shape)} onClick={(e) => handleShapeClick(e, shape)} + onTap={(e) => handleShapeClick(e, shape)} points={shape.data.points.reduce( (acc, point) => [...acc, point.x * mapWidth, point.y * mapHeight], [] diff --git a/src/components/map/MapToken.js b/src/components/map/MapToken.js index 1b644c1..3bb8a75 100644 --- a/src/components/map/MapToken.js +++ b/src/components/map/MapToken.js @@ -205,6 +205,7 @@ function MapToken({ onTouchStart={handlePointerDown} onTouchEnd={handlePointerUp} onClick={handleClick} + onTap={handleClick} onDragEnd={handleDragEnd} onDragStart={handleDragStart} opacity={tokenOpacity}